I just installed Windows 10 Creators Update (version 10.0.15063).
I have multiple versions of Visual Studio installed (2012, 2013, 2015 and 2017). I installed VS 2017 only a couple weeks ago.
Problem
CMake (version 3.8.1) no longer finds the C/C++ compiler when run inside a "VS2015 x64 Native Command Prompt" (it does work properly when run inside a VS 2017 command prompt).
Reproduction
Content of CMakeLists.txt
:
project (test)
add_executable (test test.cpp)
(Content of test.cpp
is irrelevant.)
CMake invocation, in a VS2015 x64 Native Command Prompt:
> mkdir build
> cd build
> cmake -G "Visual Studio 14 2015 Win64" ..
CMake output:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:1 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:1 (project):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!
See also "D:/dev/cmaketest/build/CMakeFiles/CMakeOutput.log".
See also "D:/dev/cmaketest/build/CMakeFiles/CMakeError.log".
Analysis
The reason of the failure is clear when looking at CMakeFiles/CMakeError.log
:
ClCompile:
C:Program Files (x86)Microsoft Visual Studio 14.0VCinx86_amd64CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
CMakeCCompilerId.c
Link:
C:Program Files (x86)Microsoft Visual Studio 14.0VCinx86_amd64link.exe /ERRORREPORT:QUEUE /OUT:".CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".CompilerIdC.lib" /MACHINE:X64 DebugCMakeCCompilerId.obj
LINK : fatal error LNK1158: cannot run 'rc.exe' [D:devcmaketestuildCMakeFiles3.8.1CompilerIdCCompilerIdC.vcxproj]
rc.exe
(Resource Compiler) is not found. Indeed, in the same VS 2015 command prompt:
> where rc.exe
INFO: Could not find files for the given pattern(s).
While it is found in a VS 2013 command prompt:
> where rc.exe
C:Program Files (x86)Windows Kits8.1inx64
c.exe
C:Program Files (x86)Windows Kits8.1inx86
c.exe
and a VS 2017 command prompt:
> where rc.exe
C:Program Files (x86)Windows Kits10in10.0.15063.0x64
c.exe
Checking the content of the PATH
environment variables in various VS command prompts:
Inside a VS 2013 command prompt, PATH
contains
C:Program Files (x86)Windows Kits8.1inx64
Inside a VS 2017 command prompt, PATH
contains
C:Program Files (x86)Windows Kits10inx64
C:Program Files (x86)Windows Kits10in10.0.15063.0x64
But inside a VS 2015 command prompt, PATH
only contains
C:Program Files (x86)Windows Kits10inx64
which does not contain rc.exe
.
Questions
Is this a known issue or is it specific to my system?
What could Windows 10 Creators Update possibly install, uninstall or alter in the system (perhaps something related to Windows SDKs) that would trigger this problem?
What is a clean way to resolve this?
Edit: Installed VS 2017 components:
See Question&Answers more detail:
os