简体   繁体   中英

CMake and Visual studio 2015 - The C compiler cl.exe is not able to compile a simple test program

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)

我解决它添加 jom.exe 到路径

我通过将工具 > 选项 > 套件中的 CMake 生成器更改为 Ninja,为 Visual Studio 2019 和 QT 5.14.1(Qt creator 4.11.0)解决了这个问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM