我在Ubuntu 14.04上安装了OpenCV。我正在尝试按照OpenCV网站上的教程进行操作。但是在运行代码时出现了错误。我使用Eclipse来运行代码,而在构建项目时遇到了问题。我已经将opencv_core、opencv_highgui和opencv_imgcodecs库添加到g++链接器中。
Error message:
//usr/local/lib/libopencv_imgproc.so.3.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [optest01] Error 1
代码:
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <stdlib.h>
#include <stdio.h>
using namespace cv;
/// Global variables
Mat src, src_gray;
Mat dst, detected_edges;
/** @function main */
int main( int argc, char** argv )
{
/// Load an image
src = imread( "/images/Lenna.jpg" );
if( !src.data )
{ return -1; }
/// Create a matrix of the same type and size as src (for dst)
dst.create( src.size(), src.type() );
/// Convert the image to grayscale
cvtColor( src, src_gray, COLOR_BGR2GRAY );
return 0;
}
opencv_imgproc
库? - Miki