cannot find -lopencv_opencv_modules
时间: 2023-11-07 13:01:04 浏览: 111
This error message usually occurs when the linker cannot find the OpenCV module libraries during compilation.
To fix this issue, you can follow these steps:
1. Make sure you have installed the OpenCV library on your system. You can check the installation by running a sample OpenCV program.
2. Check if the OpenCV module libraries are included in your project's linker settings. You can do this by adding the following line to your CMakeLists.txt file:
```
target_link_libraries(your_project_name opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs)
```
This line adds the required OpenCV module libraries to your project's linker settings.
3. If the above step does not work, you can try adding the library path to your linker settings. You can do this by adding the following line to your CMakeLists.txt file:
```
link_directories(/path/to/opencv/libraries)
```
Replace "/path/to/opencv/libraries" with the actual path where the OpenCV module libraries are stored.
4. Save the changes and recompile your project. The linker should now be able to find the OpenCV module libraries and compile your project successfully.
阅读全文