Windows7 で c/c++ 用の Eclipse IDE を使用して単純な Open CV プロジェクトを構築しようとしています。here 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