使用Qt Creator时出现CMake配置问题

时间:2017-07-02 20:56:49

标签: c++ cmake qt-creator

我正在尝试使用cmake在qt creator中建立一个构建环境,但无论我尝试什么,我都无法让它继续前进。它失败了; "配置问题"。在“常规消息”部分中展开详细信息时,看起来它无法编译测试c程序。

我无法看到我的qt创建者配置有什么问题;我必须手动设置以使用qmake为qt应用程序。这符合要求。这是配置。

enter image description here

这是一般消息中显示的完整错误;

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文件的内容似乎并不重要,因此我非常依赖于未正确配置的内容。

我试过弄乱工具链无济于事。有任何想法吗?

1 个答案:

答案 0 :(得分:1)

我最终想通了。

这是我经历的过程。最初我假设我有一些如何没有正确配置编译器工具链,所以要排除我切换到MinGW GNU工具链gcc / gdb。

问题仍然存在,因此只留下两个真正的可能性。 CMake被破坏或CMake Generator未正确配置。为了理智而忽略了第一个离开发电机的原因。

我尝试切换了一些提供的选项,显然我没有安装任何选项。但最后一个人给了我一个合理的错误,Qt Creator找不到它。 (我从nmake转到忍者)。

我安装了它,并将其添加到OS PATH环境变量中;所以Qt Creator可以找到它。 (Windows 10:控制面板>系统>高级系统设置(侧栏)>环境变量+设置路径>确定)

(Linux:添加导出PATH =“$ {PATH}”:类似于你的bashrc)。除非你从源代码安装程序,否则Linux上可能不会出现问题。

无论如何,这令人沮丧。建立一个新的开发环境很糟糕。