问题
I am trying to build an opencv 3.0.0 video project under ubuntu 14.04 on eclipse luna. This is the code sample:
#include <opencv2/opencv.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
using namespace cv;
int main( int argc, char** argv )
{
VideoCapture cap(0);
Mat edges;
namedWindow("edges", 1);
while(1) {
Mat frame;
cap >> frame;
cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
Canny(edges, edges, 0, 30, 3);
imshow("edges", edges);
if(waitKey(30) >= 0) break;
}
return 0;
}
I get the following error:
undefined reference to symbol '_ZN2cv12GaussianBlurERKNS_11_InputArrayERKNS_12_OutputArrayENS_5Size_IiEEddi'
//usr/local/lib/libopencv_imgproc.so.3.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
I get similar errors for other filters:
undefined reference to symbol '_ZN2cv8cvtColorERKNS_11_InputArrayERKNS_12_OutputArrayEii'
undefined reference to symbol '_ZN2cv5CannyERKNS_11_InputArrayERKNS_12_OutputArrayEddib'
I am linking (-l) these libs:
opencv_core
opencv_videoio
opencv_imgcodecs
opencv_highgui
opencv_objdetect
any thoughts?
回答1:
Those symbols are in the imgproc library. So you should add opencv_imgproc to your list of libraries linked with -l.
来源:https://stackoverflow.com/questions/31769245/linking-error-while-using-opencv-3-0-on-eclipse