windows10+vscode+mingw+opencv+cmake环境安装

方案一:
下载opencv源码使用cmake-gui和mingw编译,参考

https://blog.csdn.net/zhaiax672/article/details/88971248

本人参照失败,cmake生成makefile时由于有几个文件挂在外网下不下来
参照

https://blog.csdn.net/qq_38880380/article/details/78013056

花很多时间想办法下下来后,成功生成makefile,但mingw-make时卡在37%就会报错

[ 37%] Linking CXX shared library …\bin\libopencv_core341.dll
CMakeFiles\opencv_core.dir/objects.a: member CMakeFiles\opencv_core.dir/objects.
a(vs_version.rc.obj) in archive is not an object
collect2.exe: error: ld returned 1 exit status
modules\core\CMakeFiles\opencv_core.dir\build.make:2329: recipe for target ‘bin/
libopencv_core341.dll’ failed
mingw32-make[2]: *** [bin/libopencv_core341.dll] Error 1
CMakeFiles\Makefile2:1675: recipe for target ‘modules/core/CMakeFiles/opencv_cor
e.dir/all’ failed
mingw32-make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:161: recipe for target ‘all’ failed
mingw32-make: *** [all] Error 2

没能解决,暂时放弃

方案二:下载编译好的opencv省去前面的编译部分,但可能回因为编译器版本不同或设置不同无法使用,opencv编译完成github链接:
https://github.com/huihut/OpenCV-MinGW-Build/tree/master
下载完成后解压接着按照最前面的链接后面部分继续,可能因为编译器版本不同原因后出现undefined reference to cv::imread(std::__cxx11::basic_string类似错误,参考:https://blog.csdn.net/qq_29695701/article/details/89213984解决
最终成功编译windows10+vscode+mingw+opencv+cmake环境安装_第1张图片

感谢以上链接博主的分享

你可能感兴趣的:(windows10+vscode+mingw+opencv+cmake环境安装)