我正在尝试在eclipse luna上的ubuntu 14.04下构建一个opencv 3.0.0视频项目。这是代码示例:
#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;
}
我收到以下错误:
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
我的其他过滤器出现了类似的错误:
undefined reference to symbol '_ZN2cv8cvtColorERKNS_11_InputArrayERKNS_12_OutputArrayEii'
undefined reference to symbol '_ZN2cv5CannyERKNS_11_InputArrayERKNS_12_OutputArrayEddib'
我正在链接(-l)这些库:
opencv_core
opencv_videoio
opencv_imgcodecs
opencv_highgui
opencv_objdetect
有什么想法吗?
答案 0 :(得分:3)
这些符号位于imgproc库中。因此,您应该将opencv_imgproc添加到与-l。
链接的库列表中