Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QtCreator qmake Cannot run compiler 'cl'

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?

With mingw build and run fine.


I tried to add Custom build step before qmake

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64

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


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

here were screenshots


Update1. Build in Developer Command Prompt for VS 2017

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

C:\Users\Admin\source>"C:\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\bin\qmake.exe" C:\Devel\Qt\Qt5.9.1\Examples\Qt-5.9.1\datavisualization\bars\bars.pro -spec win32-msvc

C:\Users\Admin\source>nmake

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

        "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\nmake.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..\..\..\Devel\Qt\Qt5.9.1\Examples\Qt-5.9.1\datavisualization\bars -I. -I../../../include -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtDataVisualization -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtWidgets -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtGui -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtANGLE -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtCore -Irelease -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\mkspecs\win32-msvc -Forelease\ @C:\Users\Admin\AppData\Local\Temp\nm6ED7.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..\..\..\Devel\Qt\Qt5.9.1\Examples\Qt-5.9.1\datavisualization\bars -I. -I../../../include -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtDataVisualization -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtWidgets -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtGui -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtANGLE -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\include\QtCore -Irelease -I..\..\..\Devel\Qt\Qt5.9.1\5.9.1\msvc2017_64\mkspecs\win32-msvc -Forelease\ @C:\Users\Admin\AppData\Local\Temp\nm7EF5.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:release\bars.exe @C:\Users\Admin\AppData\Local\Temp\nm8417.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 Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\link.EXE"' : return code '0x458'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.

C:\Users\Admin\source>

Linkage errors. But cl.exe found.

like image 738
kyb Avatar asked Oct 04 '17 15:10

kyb


1 Answers

I had a similar case, which was solved by adding the path to cl.exe to the path environment variable:

set path=%path%;%qtdir%\bin;"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\Hostx64\x64"
set QMakeSpec=win32-msvc
qmake -tp vc

Maybe another cl.exe is interfering here?

like image 183
ScaledLizard Avatar answered Sep 17 '22 12:09

ScaledLizard