我正在尝试使用Eclipse IDE为Windows7中的c / c ++构建一个简单的Open CV项目。我按照这里的说明Building OpenCV projects in Eclipse 。但是在运行给定代码后,我收到以下错误:
#include "opencv/cv.h" // include it to used Main OpenCV functions.
#include "opencv2/highgui/highgui.hpp" //include it to use GUI functions.
int main(int argc, char** argv)
{
int iscolor = -1; /* Used to load the image as it is*/
IplImage* img = cvLoadImage((const char *)"er1.jpg", iscolor);//change the name (image.jpg) according to your Image filename.
cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( "Example1" );
return 0;}
错误:
D:\Open_CV_Codes\FirstOpenCV\Debug/../src/FirstOpenCV.c:19: undefined reference to `cvLoadImage'
D:\Open_CV_Codes\FirstOpenCV\Debug/../src/FirstOpenCV.c:20: undefined reference to `cvNamedWindow'
D:\Open_CV_Codes\FirstOpenCV\Debug/../src/FirstOpenCV.c:21: undefined reference to `cvShowImage'
D:\Open_CV_Codes\FirstOpenCV\Debug/../src/FirstOpenCV.c:22: undefined reference to `cvWaitKey'
D:\Open_CV_Codes\FirstOpenCV\Debug/../src/FirstOpenCV.c:23: undefined reference to `cvReleaseImage'
D:\Open_CV_Codes\FirstOpenCV\Debug/../src/FirstOpenCV.c:24: undefined reference to `cvDestroyWindow'
collect2.exe: error: ld returned 1 exit status
Build error occurred, build is stopped