0

我正在尝试使用 Eclipse IDE for c/c++ 在 Windows7 中构建一个简单的 Open CV 项目。我按照此处在 Eclipse 中构建 OpenCV 项目的说明进行操作 。但是在运行给定的代码后出现以下错误:

#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
4

0 回答 0