这可能是一个菜鸟问题,但我已经被困了一段时间,我很感激任何帮助......
我已经能够安装opencv并使用终端运行示例应用程序而没有任何问题但是我想使用eclipse轻松管理我的项目......
我遵循了一切,但仍然出现以下错误
/usr/bin/ld: cannot find -llibopencv_calib3d
/usr/bin/ld: cannot find -llibopencv_contrib
/usr/bin/ld: cannot find -llibopencv_core
/usr/bin/ld: cannot find -llibopencv_features2d
/usr/bin/ld: cannot find -llibopencv_flann
/usr/bin/ld: cannot find -llibopencv_gpu
/usr/bin/ld: cannot find -llibopencv_highgui
/usr/bin/ld: cannot find -llibopencv_imgproc
/usr/bin/ld: cannot find -llibopencv_legacy
/usr/bin/ld: cannot find -llibopencv_ml
/usr/bin/ld: cannot find -llibopencv_nonfree
/usr/bin/ld: cannot find -llibopencv_objdetect
/usr/bin/ld: cannot find -llibopencv_photo
/usr/bin/ld: cannot find -llibopencv_stitching
/usr/bin/ld: cannot find -llibopencv_superres
/usr/bin/ld: cannot find -llibopencv_ts
/usr/bin/ld: cannot find -llibopencv_video
/usr/bin/ld: cannot find -llibopencv_videostab
collect2: error: ld returned 1 exit status
make: *** [Test_OpenCV01] Error 1
我能够在我的步骤和教程之间找到的唯一区别是:当我运行命令时:
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_superres.so /usr/local/lib/libopencv_ts.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so
所以库名称有点不同,所以我使用我拥有的名称。
从eclipse自动执行的命令行是
g++ -L/usr/local/lib/ -o "Test_OpenCV01" ./src/main.o -llibopencv_calib3d -llibopencv_contrib -llibopencv_core -llibopencv_features2d -llibopencv_flann -llibopencv_gpu -llibopencv_highgui -llibopencv_imgproc -llibopencv_legacy -llibopencv_ml -llibopencv_nonfree -llibopencv_objdetect -llibopencv_photo -llibopencv_stitching -llibopencv_superres -llibopencv_ts -llibopencv_video -llibopencv_videostab
它清楚地指定库路径是 /usr/local/lib/ 这是共享库所在的位置,但是在错误中它说它在 /usr/bin/ld 中找不到 lib 文件
ps我都试过了
1)配置OpenCV以使用共享库:
须藤gedit /etc/ld.so.conf.d/opencv.conf
并在文件末尾添加以下行
/usr/local/lib 保存后正在运行的 sudo ldconfig。
2)运行命令
导出 LD_LIBRARY_PATH=/usr/local/lib
我还添加了
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig 导出 PKG_CONFIG_PATH
到 /etc/bash.bashrc 文件的末尾。
感谢您在高级方面的帮助。