问题
I installed OpenCV 4.1 on Ubuntu 18.04 LTS. The problem is when I compile my project's CMake file, the output is:
/usr/bin/ld: cannot find -lopencv_nonfree
collect2: error: ld returned 1 exit status
CMakeFiles/river_flow_velocity_estimation.dir/build.make:274: recipe for target 'river_flow_velocity_estimation' failed
make[2]: *** [river_flow_velocity_estimation] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/river_flow_velocity_estimation.dir/all' failed
make[1]: *** [CMakeFiles/river_flow_velocity_estimation.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
My CMake flags when I compile OpenCV are:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D BUILD_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=YES -D OPENCV_ENABLE_NONFREE=ON -D WITH_OPENMP=ON -D WITH_OPENCL=ON -D INSTALL_CREATE_DISTRIB=ON -DBUILD_opencv_world=OFF -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
Can someone help me?
来源:https://stackoverflow.com/questions/58952349/usr-bin-ld-cannot-find-lopencv-nonfree