Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Eclipse opencv “not declared in the scope” errors at compilation

I am trying to run the following simple image display opencv program on ubuntu machine.

#include <opencv/cv.h>
#include <opencv/highgui.h>

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", CV_WINDOW_AUTOSIZE );
  imshow( "Display Image", image );

  waitKey(0);

  return 0;
}

when I try to compile it I get errors saying imread, namedWindow, waitKey were not declared in the scope. I followed the eclipse setup instructions on OpenCV website and added include paths(usr/local/include/opencv), library path(usr/local/lib) and library files (opencv_core, opencv_highgui, etc). Any suggestions on solving this ?

Eclipse opencv “not declared in the scope” errors at compilation

I am trying to run the following simple image display opencv program on ubuntu machine.

#include <opencv/cv.h>
#include <opencv/highgui.h>

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", CV_WINDOW_AUTOSIZE );
  imshow( "Display Image", image );

  waitKey(0);

  return 0;
}

when I try to compile it I get errors saying imread, namedWindow, waitKey were not declared in the scope. I followed the eclipse setup instructions on OpenCV website and added include paths(usr/local/include/opencv), library path(usr/local/lib) and library files (opencv_core, opencv_highgui, etc). Any suggestions on solving this ?solvingthis?