首页 > 解决方案 > cmake 上的 Windows 错误将 Opencv 与 Qt 链接

问题描述

我正在尝试通过使用 cmake 添加我的 opencv 并为 Qt 贡献模块,例如此视频https://www.youtube.com/watch?v=NwLkwfCt9mM&t=191s

但是我安装了Qt并像这样添加了系统变量的路径: C:/Users/Gökhan/Desktop/cmake-3.19.8-win64-x64/bin C:/Qt/Qt5.12.11/Tools/mingw730_64/bin C:/ Qt/Qt5.12.11/5.12.11/mingw73_64/bin

当我试图将 opencv 添加到 qt cmake 时说:

Error in configuration process, project files may be invaild.

这是写在下划线中的错误:

CMake Error at C:/Users/Gökhan/Desktop/cmake-3.19.8-win64-x64/share/cmake-3.19/Modules/CMakeTestCXXCompiler.cmake:59 (message):
  The C++ compiler

    "C:/Qt/Qt5.12.11/Tools/mingw730_64/bin/g++.exe"

无法编译简单的测试程序。

它失败并显示以下输出:

Change Dir: C:/New folder (4)/opencv-4.5.2/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Qt/Qt5.12.11/Tools/mingw730_64/bin/mingw32-make.exe cmTC_db0d5/fast && C:/Qt/Qt5.12.11/Tools/mingw730_64/bin/mingw32-make.exe  -f CMakeFiles\cmTC_db0d5.dir\build.make CMakeFiles/cmTC_db0d5.dir/build

mingw32-make.exe[1]: Entering directory 'C:/New folder (4)/opencv-4.5.2/build/CMakeFiles/CMakeTmp'

process_begin: CreateProcess(NULL, C:\Users\Gökhan\Desktop\cmake-3.19.8-win64-x64\bin\cmake.exe -E cmake_echo_color --switch= "--progress-dir=C:\New folder (4)\opencv-4.5.2\build\CMakeFiles\CMakeTmp\CMakeFiles" --progress-num=1 "Building CXX object CMakeFiles/cmTC_db0d5.dir/testCXXCompiler.cxx.obj", ...) failed.

make (e=2): The system cannot find the file specified.


mingw32-make.exe[1]: *** [CMakeFiles\cmTC_db0d5.dir\build.make:83: CMakeFiles/cmTC_db0d5.dir/testCXXCompiler.cxx.obj] Error 2

mingw32-make.exe[1]: Leaving directory 'C:/New folder (4)/opencv-4.5.2/build/CMakeFiles/CMakeTmp'

mingw32-make.exe: *** [Makefile:139: cmTC_db0d5/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:107 (enable_language)

我已经检查了解决方案,但我使用 Windows 8 的方式无法实现任何目标

标签: qtopencvuser-interfacecmake

解决方案


推荐阅读