I'm a newbie, and I can't figure out the problem with this code. [closed]
TL;DR - Certain code from OpenCV's own tutorial won't work on my system, when multiple examples already do...
I think I have correctly installed OpenCV 3.2.0 on my i686 system via MinGW 6.2.0, because when I was building my libraries, I also build that contours.cpp
example, and it along with 3 other example files worked fine. I have now picked up this tutorial code from OpenCV's own Eclipse CDT documention.
#include <opencv2/opencv.hpp>
using namespace cv;
int main( int argc, char** argv )
{
Mat image;
image = imread( argv[1], 1 );
if( argc != 2 || !image.data )
{
printf( "No image data \n" );
return -1;
}
namedWindow( "Display Image", WINDOW_AUTOSIZE );
imshow( "Display Image", image );
waitKey(0);
return 0;
}
but it displays the following error on my system...
undefined reference to `cv::imread(cv::String const&, int)'
Please tell me what I'm doing wrong...
i can't help at all with eclipse (it's a monster !) , but you're not linking your program against opencv libs.
there must be some place labelled like "linker something", where you're supposed to add opencv_world320.a
have another look here , it's 8b in the tutorial, you have to add
opencv_world320
there. (on win, the libs need the version number, but not on linux)also adjust the library search path (-L) !
You should link your app with the opencv_highgui.dll
@pi - can you take a look here - it's opencv3, not 2.4, also an opencv_world lib was built (not single libs).
@berak - ok, check if your application linked with opencv_world.dll
Thanks. Not sure what happened, but using opencv_world, instead of using the separate libraries, worked.