2

I am trying to compile my programme using microsoft visual studio 2015 combine with cmake on Qt creator and I get this error that I really do not know how to solve.

Running "C:\Program Files\CMake\bin\cmake.exe C:/Users/SEVLH/Documents/sodis"-GCodeBlocks - NMake Makefiles" "-DCMAKE_CXX_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe" "-DCMAKE_C_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe" "-DCMAKE_PREFIX_PATH:STRING=C:/Qt/Qt5.8.0/5.8/msvc2015_64" "-DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/Qt5.8.0/5.8/msvc2015_64/bin/qmake.exe"" in C:\Users\SEVLH\AppData\Local\Temp\qtc-cmake-Yu2EZw.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe" is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/Users/SEVLH/AppData/Local/Temp/qtc-cmake-Yu2EZw/CMakeFiles/CMakeTmp



Run Build Command:"nmake" "/NOLOGO" "cmTC_eda15\fast"

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\nmake.exe" -f CMakeFiles\cmTC_eda15.dir\build.make 
/nologo -L CMakeFiles\cmTC_eda15.dir\build

Building C object CMakeFiles/cmTC_eda15.dir/testCCompiler.c.obj

C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe -o
CMakeFiles\cmTC_eda15.dir\testCCompiler.c.obj -c
C:\Users\SEVLH\AppData\Local\Temp\qtc-cmake-Yu2EZw\CMakeFiles\CMakeTmp\testCCompiler.c


NMAKE : fatal error U1045: spawn failed : Invalid argument

 Stop.

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\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)
andresouris
  • 37
  • 2
  • 6
  • Perhaps it is this: https://stackoverflow.com/questions/30553318/cmake-cl-exe-is-not-able-to-compile-a-simple-test-program – drescherjm Jul 19 '17 at 14:19
  • I already tried but it still does not work. – andresouris Jul 19 '17 at 14:25
  • Are you running this as a normal user in a Visual Studio 2015 command prompt ( 32 or 64 bit)? – drescherjm Jul 19 '17 at 14:27
  • ***NMAKE : fatal error U1045: spawn failed : Invalid argument*** Seems to be the problem. I am unfamiliar with this error. – drescherjm Jul 19 '17 at 14:27
  • `I am trying to compile my programme using microsoft visual studio 2015` - If so, why do you use "CodeBlocks - NMake Makefiles" [CMake generator](https://cmake.org/cmake/help/v3.7/manual/cmake-generators.7.html)? Use "Visual Studio 14 2015" generator instead. – Tsyvarev Jul 19 '17 at 20:28

2 Answers2

1

I solve it adding jom.exe to the path

0

I solved this problem for Visual Studio 2019 and QT 5.14.1 (Qt creator 4.11.0) by changing CMake generator in Tools > Options > Kits to Ninja.

Linh Dao
  • 1,305
  • 1
  • 19
  • 31