MinGW+OpenCV4.3+QT环境搭建

主要流程参考:
MinGW+OpenCV4.2+QT源码编译到程序演示

部分问题的解决

由于网络问题,部分文件无法下载会报202错误,需手动下载。

在CMakeDownloadLog查看需要手动下载的的网址

MinGW+OpenCV4.3+QT环境搭建_第1张图片

下载并替换这三个文件

MinGW+OpenCV4.3+QT环境搭建_第2张图片

打开Windows PowerShell(win10版本自带的),输入下面命令:

$client = new-object System.Net.WebClient
$client.DownloadFile('https://raw.githubusercontent.com/opencv/opencv_3rdparty/3d2e97081683265950316c65a52c2e8858ffba1b/ffmpeg/ffmpeg_version.cmake','C:\Users\67231\Desktop\ffmpeg_version.cmake')

其中:https://raw.githubusercontent.com/opencv/opencv_3rdparty/3d2e97081683265950316c65a52c2e8858ffba1b/ffmpeg/ffmpeg_version.cmake是其中的一个文件下载地址,

C:\Users\67231\Desktop\ffmpeg_version.cmake是文件保存的路径。

opencv编译错误:
[ 67%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/undistort.avx2.cpp.obj
[ 67%] Building RC object modules/world/CMakeFiles/opencv_world.dir/vs_version.rc.obj
gcc: error: long: No such file or directory
C:\mingw64\bin\windres.exe: preprocessing failed.
mingw32-make[2]: *** [modules\world\CMakeFiles\opencv_world.dir\build.make:7213: modules/world/CMakeFiles/opencv_world.dir/vs_version.rc.obj] Error 1
mingw32-make[2]: *** Waiting for unfinished jobs....
mingw32-make[1]: *** [CMakeFiles\Makefile2:2373: modules/world/CMakeFiles/opencv_world.dir/all] Error 2
mingw32-make: *** [Makefile:182: all] Error 2

解决方法:

MinGW+OpenCV4.3+QT环境搭建_第3张图片

Add entry

MinGW+OpenCV4.3+QT环境搭建_第4张图片

OPENCV_ALLOCATOR_STATS_COUNTER_TYPE
int64_t
在cmd中编译
mingw32-make -j 8
mingw32-make install

你可能感兴趣的:(Qt5)