我已经在Eclipse Mars中配置了OpenCV 3.1.0。以下是我的配置:
G++包含目录:D:/opencv/build/install/include;GCC包含目录:D:/opencv/build/install/include
链接库:libopencv_core310,libopencv_highgui310
链接库路径:D:/opencv/build/lib(该目录下的文件类似于libopencv_core310.dll.a)
我遇到了以下错误:
imageRead.cpp:15: undefined reference to `cv::imread(cv::String const&, int)'
这是我的imageRead.cpp文件。
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace std;
using namespace cv;
int main(int argc, const char** argv) {
Mat img = imread("D:/sample.jpg", CV_LOAD_IMAGE_UNCHANGED);
if (img.empty()) {
cout << "Error: Image cannot be loaded." << endl;
system("pause");
return -1;
}
namedWindow("Image Window", CV_WINDOW_AUTOSIZE);
imshow("Image Window", img);
if (waitKey() == 27) {
return -1;
}
destroyWindow("Image Window");
return 0;
}
有人能帮忙解决这个错误吗?