QtCreator qmake 无法运行编译器'cl'

QtCreator qmake Cannot run compiler #39;cl#39;(QtCreator qmake 无法运行编译器cl)

本文介绍了QtCreator qmake 无法运行编译器'cl'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚使用 MSVS 2017 和 Qt5.9.1 配置了新的 windows 环境.
在构建示例项目时 bars 遇到错误

Just configured new windows environment with MSVS 2017 and Qt5.9.1.
While building example project bars met an error

Project ERROR: Cannot run compiler 'cl'. Maybe you forgot to setup the environment?

使用 mingw 构建并运行良好.

With mingw build and run fine.

我尝试在 qmake

"C:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCAuxiliaryBuildvcvarsall.bat" amd64

但得到了相同的结果.在 cmd 中,此命令可以正常工作.之后 cl.exe 就可以访问了.

But got the same results. In cmd this command works fine. After it cl.exe is reachable.

所有工具集都是由 Qt 自动找到的,并且似乎是正确的

All toolsets was found automatically by Qt and seems to be right

这里是截图

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26730.16
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************

C:UsersAdminsource>"C:DevelQtQt5.9.15.9.1msvc2017_64inqmake.exe" C:DevelQtQt5.9.1ExamplesQt-5.9.1datavisualizationarsars.pro -spec win32-msvc

C:UsersAdminsource>nmake

Microsoft (R) Program Maintenance Utility Version 14.11.25508.2
Copyright (C) Microsoft Corporation.  All rights reserved.

        "C:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.11.25503inHostX86x86
make.exe" -f Makefile.Release

Microsoft (R) Program Maintenance Utility Version 14.11.25508.2
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_DATAVISUALIZATION_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I......DevelQtQt5.9.1ExamplesQt-5.9.1datavisualizationars -I. -I../../../include -I......DevelQtQt5.9.15.9.1msvc2017_64include -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtDataVisualization -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtWidgets -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtGui -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtANGLE -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtCore -Irelease -I......DevelQtQt5.9.15.9.1msvc2017_64mkspecswin32-msvc -Forelease @C:UsersAdminAppDataLocalTemp
m6ED7.tmp
main.cpp
graphmodifier.cpp
Generating Code...
        cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_DATAVISUALIZATION_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I......DevelQtQt5.9.1ExamplesQt-5.9.1datavisualizationars -I. -I../../../include -I......DevelQtQt5.9.15.9.1msvc2017_64include -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtDataVisualization -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtWidgets -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtGui -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtANGLE -I......DevelQtQt5.9.15.9.1msvc2017_64includeQtCore -Irelease -I......DevelQtQt5.9.15.9.1msvc2017_64mkspecswin32-msvc -Forelease @C:UsersAdminAppDataLocalTemp
m7EF5.tmp
moc_graphmodifier.cpp
        link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:releasears.exe @C:UsersAdminAppDataLocalTemp
m8417.tmp
Qt5DataVisualization.lib(Qt5DataVisualization.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
NMAKE : fatal error U1077: '"C:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.11.25503inHostX86x86link.EXE"' : return code '0x458'
Stop.
NMAKE : fatal error U1077: '"C:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.11.25503inHostX86x86
make.exe"' : return code '0x2'
Stop.

C:UsersAdminsource>

联动错误.但是找到了cl.exe.

Linkage errors. But cl.exe found.

推荐答案

接下来的步骤一切正常.

After next steps all runs fine.

  1. 为 QtCreator 设置 Dracula 样式:)
  2. 修改 MSVS 安装,添加 VC++ 2015.3 v140 桌面工具集(x86、x64).

很奇怪.这就是我不喜欢窗户的原因.它过着自己的生活!

Very strange. And that is why I don't like windows. It lives its own live!

所以答案是尝试重新安装/修改组件,包括 QtCreator 本身.

So the answer is TRY TO REINSTALL/modify components, including QtCreator itself.

这篇关于QtCreator qmake 无法运行编译器'cl'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:QtCreator qmake 无法运行编译器'cl'