ubuntu上的opencv - 无法找到lib文件

时间:2012-12-15 12:21:48

标签: eclipse ubuntu opencv g++

我正在关注此guide

使用eclipse juno CDT让opencv在ubuntu 12.04上运行。但是当我构建所有内容时,我收到了这个错误:

Building target: DisplayImage
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o "DisplayImage"  ./src/DisplayImage.o   -lopencv_core\ opencv_imgproc\ opencv_highgui
/usr/bin/ld: cannot find -lopencv_core opencv_imgproc opencv_highgui
collect2: ld returned 1 exit status
make: *** [DisplayImage] Error 1

在日食中我添加了:

opencv_core opencv_imgproc opencv_highgui

在“库(-l)”框中。如果我跑(如指南中所述):

pkg-config --libs opencv

我明白了:

/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so  

所以它们似乎存在。但与指南相比,名称有点不同。我试图将eclipse中的包含更改为:

libopencv_core.so libopencv_imgproc.so opencv_highgui

但这没有用。有什么想法吗?

编辑:

这就是我设置包含的方式:

enter image description here

这就是我设置libs(链接器)的方式:

enter image description here

2 个答案:

答案 0 :(得分:4)

啊每个lib必须在C ++链接器 - >库中的单独行上。

答案 1 :(得分:1)

您似乎忘了在Library search path(-L)中将usr/local/lib/设置为C++ Linker->Libraries

enter image description here

从屏幕截图中

更新:我看到所有的库都在一行中。再看一下我的截图。