Im trying to set up openCV on my mac and work with it in Eclipse with C++. But I think somthing is wrong with the linker. I included all libraries as described here: http://ift.tt/11sf5Qd
I tried the linker commands g++
and g++ -std=c++11
but get always the same error message:
g++ -L/usr/local/lib -o camera src/Camera.o -lopencv_core -lopencv_ml -
lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_flann -lopencv_imgproc -lopencv_highgui
Undefined symbols for architecture x86_64:
"cv::imread(cv::String const&, int)", referenced from:
_main in Camera.o
ld: symbol(s) not found for architecture x86_64
for the following code:
#include "/usr/local/include/opencv/cv.hpp"
#include "/usr/local/include/opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
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;
}
Aucun commentaire:
Enregistrer un commentaire