使用Qt Creator时CMake配置问题 [英] CMake Configuration Issue when using Qt Creator

查看:1168
本文介绍了使用Qt Creator时CMake配置问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用cmake在qt Creator中设置一个构建环境,但是无论如何我都无法使其进展。它因问题而失败; 配置问题。当在常规消息部分中扩展详细信息时,似乎无法编译测试c程序。

I am trying to set up a build environment in qt creator using cmake, but no matter what I try I cannot get it to progress. It fails with issue; "Configuration Issue". When expanding the details in the General Messages section it looks like its failing to compile a test c program.

我的qt创建者配置没有发现任何问题;我过去必须手动设置才能将qmake用于qt应用程序。这按预期工作。这就是该配置。

I can't see anything wrong with my qt creator configuration; which I had to set up in the past manually to use qmake for a qt app. This worked as desired. Here is that configuration.

这是一般消息中显示的全部错误;

This is the error in full as displayed in general messages;

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文件的内容似乎无关紧要,因此我主要依靠

The content of the actual CMake file doesn't seem to matter, so I'm heavily leaning on something not being correctly configured.

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

I've tried messing with the toolchain to no avail. Any ideas?

推荐答案

我终于弄清楚了。

这是我经历的过程。最初,我以为我有一些如何无法正确配置编译器工具链的方法,因此,我决定改用MinGW GNU工具链gcc / gdb。

This is the process I went through. Initially I assumed I had some how not configured the compiler toolchain correctly, so to rule that out I switched to the MinGW GNU toolchain gcc/gdb.

问题仍然存在,因此只有两种实际可能性。 CMake损坏或CMake生成器配置不正确。出于理智的考虑,第一个忽略了生成器。

The issue persisted, so that left only two real possibility. CMake was broken or the CMake Generator wasn't correctly configured. Ignoring the first for sanity reasons that left the generator.

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

I tried switching through a few of the provided options, obviously I didn't have any of them installed. But finally one gave me a reasonable error, that Qt Creator couldn't find it. (I switched to ninja from nmake).

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

I installed it, and added it to the OS PATH environment variable; so Qt Creator could find it. (Windows 10: Control Panel > System > Advanced system settings (sidebar) > Environment Variables + Set Path > OK)

(Linux:添加导出路径= $ {PATH }:类似于您的bashrc)。除非您从源代码安装程序,否则在Linux上可能不会成为问题。

(Linux: add export PATH="${PATH}": to something like your bashrc). Probably wouldn't be an issue on Linux unless you installed the program from source.

无论如何,这令人沮丧。设置新的开发环境很糟糕。

Anyway, that was frustrating. Setting up a new development environment sucks.

这篇关于使用Qt Creator时CMake配置问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆