1

I am trying to detect faces and eyes from a video captured by webcam. I am using eclipse and opencv-2.3.1 on ubuntu 11.10. I want to write this code in C/C++. I configured eclipse by looking at the tutorials.I got the code online as objectDetection.cpp

I am getting the error as below:

> **** Build of configuration Release for project opencv_try **** make all 
> Building file: ../objectDetection2.cpp 
> Invoking: GCC C++ Compiler 
> g++ -I/home/vidula/OpenCV-2.3.1/include/opencv -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"objectDetection2.d" -MT"objectDetection2.d" -o"objectDetection2.o" "../objectDetection2.cpp" 
> Finished building: ../objectDetection2.cpp  
> Building target: opencv_try 
> Invoking: GCC C++ Linker 
> g++ -L/usr/lib -L/home/vidula/OpenCV-2.3.1/lib -L/home/vidula/OpenCV-2.3.1/modules/imgproc/include/opencv2/imgproc -o"opencv_try"  ./objectDetection2.o   -lopencv_core -lopencv_highgui 
> /usr/bin/ld: ./objectDetection2.o: undefined reference to symbol 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' 
> /usr/bin/ld: note: 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' is defined in DSO /usr/local/lib/libopencv_imgproc.so.2.3 so try adding it to the linker command line 
> /usr/local/lib/libopencv_imgproc.so.2.3: could not read symbols: Invalid operation collect2: ld returned 1 exit status make:
> *** [opencv_try] Error 1

I tried linking it to linkers but I don't know what I am doing wrong. Can anyone help me figure out what is wrong?

4

1 回答 1

1

看起来它告诉您cv::cvtColor您需要的符号在libopencv_imgproc库中,因此您需要使用 option 将该符号添加到链接器选项中-lopencv_imgproc,就像您对coreand所做的那样highgui

于 2012-12-31T19:32:13.457 回答