我正在尝试使用 cmake 在 qt Creator 中设置构建环境,但无论我尝试什么,我都无法让它取得进展。它因问题而失败; “配置问题”。当展开一般消息部分中的详细信息时,它看起来像是无法编译测试 C 程序。
我看不出我的 qt 创建者配置有什么问题;我过去必须手动设置才能将 qmake 用于 qt 应用程序。这按预期工作了。这是该配置。
这是一般消息中显示的完整错误;
Running Windows Runtime device detection.
No winrtrunner.exe found.
Running "C:\Program Files\CMake\bin\cmake.exe -E server "--pipe=\\.\pipe\{8454d5f3-9c7b-42c8-8f39-a6bfbbbdd562}" --experimental" in
C:\Users\Andrew\AppData\Local\Temp\QtCreator-l9Mfi9\qtc-cmake-XXUaBP1D.
The C compiler identification is MSVC 19.0.24215.1
The CXX compiler identification is MSVC 19.0.24215.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_amd64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_amd64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/BIN/x86_amd64/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Andrew/AppData/Local/Temp/QtCreator-l9Mfi9/qtc-cmake-XXUaBP1D/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_2c22c\fast"
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f
CMakeFiles\cmTC_2c22c.dir\build.make /nologo -L
CMakeFiles\cmTC_2c22c.dir\build
Building C object CMakeFiles/cmTC_2c22c.dir/testCCompiler.c.obj
C:\PROGRA~2\MICROS~1.0\VC\BIN\X86_AM~1\cl.exe
@C:\Users\Andrew\AppData\Local\Temp\nm7672.tmp
testCCompiler.c
Linking C executable cmTC_2c22c.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
--intdir=CMakeFiles\cmTC_2c22c.dir --manifests --
C:\PROGRA~2\MICROS~1.0\VC\bin\X86_AM~1\link.exe /nologo
@CMakeFiles\cmTC_2c22c.dir\objects1.rsp
@C:\Users\Andrew\AppData\Local\Temp\nm76B2.tmp
MT failed to run.
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' :
return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/Andrew/AppData/Local/Temp/QtCreator-l9Mfi9/qtc-cmake-XXUaBP1D/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Andrew/AppData/Local/Temp/QtCreator-l9Mfi9/qtc-cmake-XXUaBP1D/CMakeFiles/CMakeError.log".
实际 CMake 文件的内容似乎并不重要,因此我严重依赖于未正确配置的内容。
我尝试过弄乱工具链但无济于事。有任何想法吗?
我最后想通了。
这就是我经历的过程。最初,我假设我有一些未正确配置编译器工具链的情况,因此为了排除这种情况,我切换到了 MinGW GNU 工具链 gcc/gdb。
这个问题仍然存在,因此只剩下两种真正的可能性。 CMake 已损坏或 CMake 生成器未正确配置。出于理智原因忽略第一个,离开了生成器。
我尝试切换提供的一些选项,显然我没有安装其中任何一个。但最终有人给了我一个合理的错误,即 Qt Creator 找不到它。 (我从 nmake 切换到 ninja)。
我安装了它,并将其添加到操作系统PATH环境变量中;这样 Qt Creator 就可以找到它。 (Windows 10:控制面板 > 系统 > 高级系统设置(边栏) > 环境变量 + 设置路径 > 确定)
(Linux:将 export PATH="${PATH}": 添加到 bashrc 之类的内容中)。除非您从源代码安装该程序,否则在 Linux 上可能不会出现问题。
无论如何,这令人沮丧。设置新的开发环境很糟糕。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)