【问题标题】:opencv with netbeans c++ linker error带有netbeans c ++链接器错误的opencv
【发布时间】:2015-11-30 01:22:23
【问题描述】:

我正在尝试运行我在网上找到的以下代码,以查看我是否正确设置了 opencv,

#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace std;

int main(int argc, char** argv) {

namedWindow("Output",1);

//initialize a 120X350 matrix of black pixels:
Mat output = Mat::zeros( 120, 350, CV_8UC3 );

//write text on the matrix:
putText(output,
        "Hello World :)",
        cvPoint(15,70),
        FONT_HERSHEY_PLAIN,
        3,
        cvScalar(0,255,0),
        4);

//display the image:
imshow("Output", output);

//wait for the user to press any key:
waitKey(0);

return 0;

}

我在编译时遇到以下错误,

main.cpp: In function 'int main(int, char**)':
main.cpp:12:27: error: 'namedWindow' was not declared in this scope
main.cpp:15:5: error: 'Mat' was not declared in this scope
main.cpp:15:9: error: expected ';' before 'output'
main.cpp:18:13: error: 'output' was not declared in this scope
main.cpp:21:13: error: 'FONT_HERSHEY_PLAIN' was not declared in this     scope
main.cpp:24:14: error: 'putText' was not declared in this scope
main.cpp:27:28: error: 'imshow' was not declared in this scope
main.cpp:30:14: error: 'waitKey' was not declared in this scope
nbproject/Makefile-Debug.mk:66: recipe for target `build/Debug/MinGW-  Windows/main.o' failed

我已经在 windows 上编译了 opencv 3.0.0,并在我的项目中添加了以下属性, 包含目录 - E:/software/opencv/build/include 附加库目录 - E:/software/opencv/release/lib 我已经将 E:/software/opencv/release/lib 中的所有库添加到链接器库中。

【问题讨论】:

  • 您是否已将 OpenCV 添加到您的 Path 环境变量中?

标签: c++ opencv netbeans linker


【解决方案1】:

我认为这可能很容易解决。 添加:

 using namespace cv;

高于或低于:

 using namespace std;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-19
    • 1970-01-01
    • 2015-07-15
    • 2017-06-20
    • 2015-04-04
    • 2018-06-27
    相关资源
    最近更新 更多