Using MSVC with latest EAP as well as with lates RC does fail because of the C compiler
Hi,
apparently someone had already a similar problem here in the beginnings of MSVC support but none of the solutions there helped in my case.
My system is quite fresh and I have installed as well Visual Studio Community, as well as Enterprise, trying all cl.exe (x86/x64).
Once Cmake loads the project the C-Compiler is not able to compile a simple test Program.
Here the whole stack trace:
"C:\Users\phili\AppData\Roaming\JetBrains\CLion 182.2757.13\bin\cmake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=C:\Users\phili\CMakeBuilds\893d6c8f-9df9-2a34-8366-b650e46b9487\install\x64-Release "-DCMAKE_CXX_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.14.26428/bin/HostX64/x64/cl.exe" "-DCMAKE_C_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.14.26428/bin/HostX64/x64/cl.exe" -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "CodeBlocks - NMake Makefiles" C:\Users\phili\Desktop\Projekte\Cpp-Seminar-examples
-- The C compiler identification is MSVC 19.14.26430.0
-- The CXX compiler identification is MSVC 19.14.26430.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.14.26428/bin/HostX64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.14.26428/bin/HostX64/x64/cl.exe -- broken
CMake Error at C:/Users/phili/AppData/Roaming/JetBrains/CLion 182.2757.13/bin/cmake/share/cmake-3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.14.26428/bin/HostX64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/phili/Desktop/Projekte/Cpp-Seminar-examples/cmake-build-release-msvc/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_5965d\fast"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\nmake.exe" -f CMakeFiles\cmTC_5965d.dir\build.make /nologo -L CMakeFiles\cmTC_5965d.dir\build
Building C object CMakeFiles/cmTC_5965d.dir/testCCompiler.c.obj
C:\PROGRA~2\MICROS~1\2017\ENTERP~1\VC\Tools\MSVC\1414~1.264\bin\HostX64\x64\cl.exe @C:\Users\phili\AppData\Local\Temp\nmEEF.tmp
testCCompiler.c
Linking C executable cmTC_5965d.exe
"C:\Users\phili\AppData\Roaming\JetBrains\CLion 182.2757.13\bin\cmake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_5965d.dir --manifests -- C:\PROGRA~2\MICROS~1\2017\ENTERP~1\VC\Tools\MSVC\1414~1.264\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_5965d.dir\objects1.rsp @C:\Users\phili\AppData\Local\Temp\nmF4E.tmp
LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2017\ENTERP~1\VC\Tools\MSVC\1414~1.264\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_5965d.dir\objects1.rsp /out:cmTC_5965d.exe /implib:cmTC_5965d.lib /pdb:C:\Users\phili\Desktop\Projekte\Cpp-Seminar-examples\cmake-build-release-msvc\CMakeFiles\CMakeTmp\cmTC_5965d.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_5965d.dir/intermediate.manifest CMakeFiles\cmTC_5965d.dir/manifest.res" failed (exit code 1120) with the following output:
testCCompiler.c.obj : error LNK2001: Nicht aufgel├Àstes externes Symbol "_RTC_InitBase".
testCCompiler.c.obj : error LNK2001: Nicht aufgel├Àstes externes Symbol "_RTC_Shutdown".
LINK : error LNK2001: Nicht aufgel├Àstes externes Symbol "mainCRTStartup".
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\kernel32.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\user32.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\gdi32.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\winspool.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\shell32.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\ole32.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\oleaut32.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\uuid.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\comdlg32.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\advapi32.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\lib\x86\store\MSVCRTD.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
cmTC_5965d.exe : fatal error LNK1120: 3 nicht aufgel├Àste Externe
NMAKE : fatal error U1077: ""C:\Users\phili\AppData\Roaming\JetBrains\CLion 182.2757.13\bin\cmake\bin\cmake.exe"": R³ckgabe-Code "0xffffffff"
Stop.
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\nmake.exe"": R³ckgabe-Code "0x2"
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
What I should mention: I have this Problem from the beginning on, since then I added to Nmake, cl.exe, link.exe the Setting to execute it as Admin and executed Clion as well as Admin. The Problem nstays the same just having some more error lines as for example:
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86\kernel32.lib : warning LNK4272:Bibliothekcomputertyp "x86" steht in Konflikt mit dem Zielcomputertyp "x64"
Hope you can help me here, I defnitely need MSVC as the other compilers do not support execution_policies for the STL, but would love to continue using CLion
Cheers,
请先登录再写评论。
Hello!
Could you please show the screenshot of File | Settings | Build, Execution, Deployment | Toolchains?
Does the issue happen with a new default "Hello, World!" project?
With a new default "Hello, World!" project it produces the same error, as well as trying different architectures.
Oh and thats the screenshot if i click on the more.. tag at the end of the Cmake Warning
Thanks a lot for the screenshot!
The issue appears because you've set the platform option to store. In this case please go to File | Settings | Build, Execution, Deployment | CMake and paste the following options into the CMake options field:
Does it help?