Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm a newbie, and I can't figure out the problem with this code.

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...