linking error while using opencv 3.0 on eclipse

前提是你 提交于 2019-12-12 03:37:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!