Opencv, DSO missing from command line collect2: error: ld returned 1 exit status
Opencv, DSO missing from command line collect2: error: ld returned 1 exit status
我将 OpenCV 安装到 Ubuntu 14.04。我正在尝试在 opencv 网站上学习教程。 运行 执行此代码时出现错误。我正在使用日食
运行 代码。我在构建项目时遇到此错误。
我向 g++ 链接器添加了 opencv_core、opencv_highgui、opencv_imgcodecs 库。
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;
}
您的错误代码:
//usr/local/lib/libopencv_imgproc.so.3.0: error adding symbols: DSO missing from command line
告诉你你还没有 linked opencv_imgproc
。
只需 link 所需的库:
-lopencv_imgproc
我有类似的问题 DSO missing from command line
并且在前面添加 -L/usr/local/lib
解决了我的问题,即 g++ source_code.cpp -o output_name -L/usr/local/lib <dependent libraries e.g. -lopencv_highgui>
我将 OpenCV 安装到 Ubuntu 14.04。我正在尝试在 opencv 网站上学习教程。 运行 执行此代码时出现错误。我正在使用日食 运行 代码。我在构建项目时遇到此错误。 我向 g++ 链接器添加了 opencv_core、opencv_highgui、opencv_imgcodecs 库。
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;
}
您的错误代码:
//usr/local/lib/libopencv_imgproc.so.3.0: error adding symbols: DSO missing from command line
告诉你你还没有 linked opencv_imgproc
。
只需 link 所需的库:
-lopencv_imgproc
我有类似的问题 DSO missing from command line
并且在前面添加 -L/usr/local/lib
解决了我的问题,即 g++ source_code.cpp -o output_name -L/usr/local/lib <dependent libraries e.g. -lopencv_highgui>