Here is a code. when i try to build it in eclipse it says "imread" and almost all functions are not declared in the scope.
#include <cv.h>
#include <opencv2/opencv.hpp>
#include <highgui.h>
using namespace cv;
int main( int argc, char** argv )
{
Mat image;
image = imread( "download.jpg",0 );
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;
}
List of errors are shown below
Description Resource Path Location Type
make: *** [src/DisplayImage1.o] Error 1 DisplayImage C/C++ Problem
make: *** [display] Error 1 display C/C++ Problem
‘namedWindow’ was not declared in this scope DisplayImage1.cpp /DisplayImage/src line 23 C/C++ Problem
‘imread’ was not declared in this scope DisplayImage1.cpp /DisplayImage/src line 15 C/C++ Problem
‘waitKey’ was not declared in this scope DisplayImage1.cpp /DisplayImage/src line 26 C/C++ Problem
‘imshow’ was not declared in this scope DisplayImage1.cpp /DisplayImage/src line 24 C/C++ Problem
undefined reference to `cvRound' display line 929, external location: /usr/local/include/opencv2/core/types_c.h C/C++ Problem
undefined reference to `cvRound' display line 930, external location: /usr/local/include/opencv2/core/types_c.h C/C++ Problem
undefined reference to `cvFree_' display line 305, external location: /usr/local/include/opencv2/core/core_c.h C/C++ Problem
undefined reference to `cvFree_' display line 313, external location: /usr/local/include/opencv2/core/core_c.h C/C++ Problem
undefined reference to `cvGetRows' display line 382, external location: /usr/local/include/opencv2/core/core_c.h C/C++ Problem
undefined reference to `cvGetCols' display line 408, external location: /usr/local/include/opencv2/core/core_c.h C/C++ Problem
undefined reference to `cvReleaseMat' display line 477, external location: /usr/local/include/opencv2/core/core_c.h C/C++ Problem
Don't know what to do. Any idea ?? i am running the code in eclipse.Load opencv library to it.i m Using ubuntu. Any help will be appriciated
console message:
make all
Building file: ../src/DisplayImage.cpp
Invoking: Cross G++ Compiler
g++ -I/usr/local/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/DisplayImage.d" -MT"src/DisplayImage.d" -o "src/DisplayImage.o" "../src/DisplayImage.cpp"
Finished building: ../src/DisplayImage.cpp
Building file: ../src/DisplayImage1.cpp
Invoking: Cross G++ Compiler
g++ -I/usr/local/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/DisplayImage1.d" -MT"src/DisplayImage1.d" -o "src/DisplayImage1.o" "../src/DisplayImage1.cpp"
../src/DisplayImage1.cpp: In function ‘int main(int, char**)’:
../src/DisplayImage1.cpp:15:30: error: ‘imread’ was not declared in this scope
image = imread( argv[1], 1 );
^
../src/DisplayImage1.cpp:23:52: error: ‘namedWindow’ was not declared in this scope
namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
^
../src/DisplayImage1.cpp:24:34: error: ‘imshow’ was not declared in this scope
imshow( "Display Image", image );
^
../src/DisplayImage1.cpp:26:12: error: ‘waitKey’ was not declared in this scope
waitKey(0);
^
make: *** [src/DisplayImage1.o] Error 1