CMake构建OpenCv并导入QT项目过程中出现的问题汇总

前言

再此之前请确保你的环境变量是否配置,这是总共需要配置的环境变量

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 of
  the following names:
    Qt5Config.cmake
    qt5-config.cmake
  Add 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 a
  separate 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,改一下后缀就行,源文件上更改是不可以的

最后,把下载来的三个文件与之前文件替换一下即可,注意文件名称要一致

后记

有什么问题,欢迎探讨✨✨✨✨

相关推荐
blasit10 小时前
笔记:Qt C++建立子线程做一个socket TCP常连接通信
c++·qt·tcp/ip
郑州光合科技余经理5 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
feifeigo1235 天前
matlab画图工具
开发语言·matlab
dustcell.5 天前
haproxy七层代理
java·开发语言·前端
norlan_jame5 天前
C-PHY与D-PHY差异
c语言·开发语言
多恩Stone5 天前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系
开发语言·c++·人工智能·python·算法·3d·aigc
QQ4022054965 天前
Python+django+vue3预制菜半成品配菜平台
开发语言·python·django
遥遥江上月5 天前
Node.js + Stagehand + Python 部署
开发语言·python·node.js
m0_531237175 天前
C语言-数组练习进阶
c语言·开发语言·算法
Railshiqian5 天前
给android源码下的模拟器添加两个后排屏的修改
android·开发语言·javascript