前言
再此之前请确保你的环境变量是否配置,这是总共需要配置的环境变量
E:\cmake\bin
E:\OpenCv\opencv\build\x64\vc15\bin
F:\Qt\Tools\mingw730_64\bin
F:\Qt\5.12.4\mingw73_64\bin
问题一:
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
解决:
双击,修改为mingw32-make.exe路径,重新configure就行了
问题二
CMake Error at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):Could not find a package configuration file provided by "Qt5" with any ofthe following names:Qt5Config.cmakeqt5-config.cmakeAdd the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"to a directory containing one of the above files. If "Qt5" provides aseparate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):CMakeLists.txt:698 (include)
解决:
双击,修改为QT5路径即可,重新configure就行了
问题三:
CMake Warning at cmake/OpenCVDownload.cmake:202 (message):FFMPEG: Download failed: 6;"Couldn't resolve host name"For details please refer to the download log file:E:/OpenCv/opencv/opencv_bulid/CMakeDownloadLog.txt
Call Stack (most recent call first):3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)modules/videoio/cmake/init.cmake:3 (include)modules/videoio/cmake/init.cmake:30 (add_backend)cmake/OpenCVModule.cmake:298 (include)cmake/OpenCVModule.cmake:361 (_add_modules_1)modules/CMakeLists.txt:7 (ocv_glob_modules)
解决:
打开CMakeDownloadLog.txt
,会发现它说缺少
opencv_videoio_ffmpeg.dll
opencv_videoio_ffmpeg_64.dll
f8e65dbe4a3b4eedc0d2997e07c3f3fd-ffmpeg_version.cmake
让你去手动下载,并把下载地址贴了出来
https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/opencv_videoio_ffmpeg.dll
https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/opencv_videoio_ffmpeg_64.dll
https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/ffmpeg_version.cmake
前两个打开后就会自动下载,第三个网址,打开后会有一个网址,点击另存txt,改一下后缀就行,源文件上更改是不可以的
最后,把下载来的三个文件与之前文件替换一下即可,注意文件名称要一致
后记
有什么问题,欢迎探讨✨✨✨✨