rc.exe no longer found in VS 2015 Command Prompt

Issue

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.0\VC\bin\x86_amd64\CL.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"Debug\vc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
  CMakeCCompilerId.c
Link:
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.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 Debug\CMakeCCompilerId.obj
LINK : fatal error LNK1158: cannot run 'rc.exe' [D:\dev\cmaketest\build\CMakeFiles\3.8.1\CompilerIdC\CompilerIdC.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 Kits\8.1\bin\x64\rc.exe
C:\Program Files (x86)\Windows Kits\8.1\bin\x86\rc.exe

and a VS 2017 command prompt:

> where rc.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\rc.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 Kits\8.1\bin\x64
    
  • Inside a VS 2017 command prompt, PATH contains

    C:\Program Files (x86)\Windows Kits\10\bin\x64
    C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64
    
  • But inside a VS 2015 command prompt, PATH only contains

    C:\Program Files (x86)\Windows Kits\10\bin\x64
    

    which does not contain rc.exe.

Questions

  1. Is this a known issue or is it specific to my system?

  2. 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?

  3. What is a clean way to resolve this?

Edit: Installed VS 2017 components:

VS 2017 components installed

Solution

Spent some time looking at this on three machines with Win10 Creators Edition and VS2010, VS2013, VS2015 and VS2017 installed, where it works on two machines and fails on the third. All had VS2015 Update 3 and all should have been installed with the same options.

Running the following batch file

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat

should setup the correct environment for VS2015 x64 environment. This should add

C:\Program Files (x86)\Windows Kits\10\bin\x64

to the PATH. This is where rc.exe should be. However on my failing machine rc.exe was missing from here, but it did exist in

C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64

I went back and feeling like this was a setup issue I re-ran the VS2015 Update 3 setup and told it to add

Windows and Web Development -> Universal Windows App Development Tools -> Tools (1.4.1) and Windows 10 SDK (10.0.14393)

this caused rc.exe and related files to appear in

C:\Program Files (x86)\Windows Kits\10\bin\x64

Running rc -v on

C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\rc.exe

and

C:\Program Files (x86)\Windows Kits\10\bin\x64\rc.exe

gave the same version number 10.0.10011.16384

Not sure why rc.exe was missing from the original install, but re-running the install and adding the other SDK fixed it for me. It looks like

C:\Program Files (x86)\Windows Kits\10\bin\x64\rc.exe

should be the default rc.exe but it was not setup by a previous install.

Answered By – DaveCleland

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published