qt中Opencv4 cmake时mingw32-make: *** [Makefile:165: all] Error 2
时间: 2023-08-14 14:08:51 浏览: 578
引用\[1\]:collect2.exe: error: ld returned 1 exit status mingw32-make\[2\]: *** \[modules\core\CMakeFiles\opencv_core.dir\build.make:1800: bin/libopencv_core451.dll\] Error 1 mingw32-make\[1\]: *** \[CMakeFiles\Makefile2:1794: modules/core/CMakeFiles/opencv_core.dir/all\] Error 2 mingw32-make: *** \[Makefile:165: all\] Error 2 。 引用\[2\]:mingw32-make\[2\]: *** \[modules\python2\CMakeFiles\opencv_python2.dir\build.make:76: modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.obj\] Error 1 mingw32-make\[1\]: *** \[CMakeFiles\Makefile2:3365: modules/python2/CMakeFiles/opencv_python2.dir/all\] Error 2 mingw32-make: *** \[Makefile:165: all\] Error 2 。 引用\[3\]:问题:gcc: error: long: No such file or directory** C:\PROGRA~2\Dev-Cpp\MinGW64\bin\windres.exe: preprocessing failed. modules\core\CMakeFiles\opencv_core.dir\build.make:1420: recipe for target ‘modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj’ failed mingw32-make\[2\]: *** \[modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj\] Error 1 mingw32-make\[2\]: *** Waiting for unfinished jobs… CMakeFiles\Makefile2:1603: recipe for target ‘modules/core/CMakeFiles/opencv_core.dir/all’ failed mingw32-make\[1\]: *** \[modules/core/CMakeFiles/opencv_core.dir/all\] Error 2 。 问题:qt中Opencv4 cmake时mingw32-make: *** \[Makefile:165: all\] Error 2
回答: 这些错误信息表明在使用Qt中的Opencv4进行cmake时出现了问题。具体来说,出现了ld returned 1 exit status、Error 1、Error 2等错误。这些错误通常是由于编译器无法找到所需的文件或目录导致的。可能的原因包括缺少依赖项、路径设置错误或编译器配置问题。为了解决这些错误,您可以尝试以下几个步骤:
1. 确保您已正确安装了Opencv4和Qt,并且它们的路径已正确设置。
2. 检查您的编译器配置是否正确,包括编译器版本和路径设置。
3. 检查您的项目配置文件是否正确,包括CMakeLists.txt文件中的路径和依赖项设置。
4. 确保您的系统中已安装所需的依赖项,并且它们的路径正确。
5. 尝试清理并重新构建您的项目,以确保所有文件和依赖项都正确配置。
如果您仍然遇到问题,建议您查阅Opencv4和Qt的官方文档,以获取更详细的指导和解决方案。
#### 引用[.reference_title]
- *1* *2* [Qt5.14+Opencv4.1+CMake3.22配置](https://blog.csdn.net/qq_45792470/article/details/125774264)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [OpenCV使用CMake和MinGW-w64的编译安装](https://blog.csdn.net/qq_61604164/article/details/121731875)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文