“/usr/bin/ld: 在 Ubuntu 20.04 中编译 opencv 项目时找不到 -llibopencv_calib3d”
Posted
技术标签:
【中文标题】“/usr/bin/ld: 在 Ubuntu 20.04 中编译 opencv 项目时找不到 -llibopencv_calib3d”【英文标题】:"/usr/bin/ld: cannot find -llibopencv_calib3d" when compiling an opencv project in Ubuntu 20.04 【发布时间】:2021-11-19 20:57:06 【问题描述】:我已经按照OpenCV Installation in Linux 中的说明在 Ubuntu 20.04 中安装了 opencv。根据说明,sudo make install
将所有 .so 文件复制到 /usr/local/lib
。
但是,在编译程序时,使用命令g++ --std c++17 -g opencv/Basic.cpp -o output -I/usr/local/include/opencv4 -L/usr/local/lib/ -llibopencv_calib3d -llibopencv_core -llibopencv_dnn -llibopencv_features2d -llibopencv_flann -llibopencv_highgui -llibopencv_imgcodecs -llibopencv_imgproc -llibopencv_ml -llibopencv_objdetect -llibopencv_photo -llibopencv_stitching -llibopencv_video -llibopencv_videoio
我得到以下错误。
/usr/bin/ld: cannot find -llibopencv_calib3d
/usr/bin/ld: cannot find -llibopencv_core
/usr/bin/ld: cannot find -llibopencv_dnn
/usr/bin/ld: cannot find -llibopencv_features2d
/usr/bin/ld: cannot find -llibopencv_flann
/usr/bin/ld: cannot find -llibopencv_highgui
/usr/bin/ld: cannot find -llibopencv_imgcodecs
/usr/bin/ld: cannot find -llibopencv_imgproc
/usr/bin/ld: cannot find -llibopencv_ml
/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_video
/usr/bin/ld: cannot find -llibopencv_videoio
collect2: error: ld returned 1 exit status
我还在/etc/ld.so.conf.d/opencv.conf
中添加了一个带有/usr/local/lib/
行的.conf 文件,并发出了命令sudo ldconfig
。但是,问题仍然存在。
对于解决此问题的任何想法或建议,我将不胜感激。
【问题讨论】:
【参考方案1】:-llibopencv_calib3d
做起来
-lopencv_calib3d
等等。前面的lib
部分是完全错误的
【讨论】:
太棒了!感谢您的及时回复。以上是关于“/usr/bin/ld: 在 Ubuntu 20.04 中编译 opencv 项目时找不到 -llibopencv_calib3d”的主要内容,如果未能解决你的问题,请参考以下文章