Skip to content
Advertisement

“/usr/bin/ld: cannot find -llibopencv_calib3d” when compiling an opencv project in Ubuntu 20.04

I have installed opencv in Ubuntu 20.04 following the instructions in OpenCV Installation in Linux. As per the instructions, sudo make install copies all the .so files to /usr/local/lib.

However, when compiling a program, using the command 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 I get the following error.

/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

I have also added a .conf file in /etc/ld.so.conf.d/opencv.conf with the line /usr/local/lib/ and issued the command sudo ldconfig. However, the issue remains.

I’d be grateful for any ideas or suggestions to resolve this issue.

Advertisement

Answer

-llibopencv_calib3d

make it

-lopencv_calib3d

etc. the lib part in front of it is simply wrong

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement