TRK0005 error locating rc.exe building VC++ 2015 project

Robin picture Robin · Apr 6, 2017 · Viewed 8.1k times · Source

I have a VS 2015 C++ project (64-bit Windows 10 + Windows 10 SDK).

With the Project Properties > General > Target Platform Version set to "8.1", everything builds fine.

When I change it to "10.0.15063.0", I hit this error:

Error TRK0005 Failed to locate: "rc.exe". The system cannot find the file specified.

I saw from other posts that the fix is to paste the exe to somewhere it can be found. I'm looking for something a bit more solid (e.g. version controlled).

When set to 8.1, the $(WindowsSDK_ExecutablePath) macro includes this path:

C:\Program Files (x86)\Windows Kits\8.1\bin\x86

with rc.exe in it.

When set to 10.0.15063.0, none of the paths in the macro have an rc.exe inside them. If I add this path to the Executable Directories, the problem goes away:

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

My questions:

  • Is what I'm seeing expected or should rc.exe be found out-the-box?
  • Is it safe for me to add this extra path or am I likely to break something?
  • Am I using the correct extra path? (The 8.1 path includes "x86".)

Thanks

Answer

Alexey Voytenko picture Alexey Voytenko · Feb 20, 2020

1) rc.exe should be found out of the box. The issue may be related to a different Windows 10 SDK path schemes which was changed in newer Windows 10 SDKs. Please, check, if VS2015 files point to the folder C:\Program Files (x86)\Windows Kits\10\bin\x64 (You can see the value of the macro for $(WindowsSDK_ExecutablePath)). Latest Windows 10 SDK are installed in parallel subfolders so you may install different Windows 10 SDK, with folders like: C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64 C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64

If VS expects SDK in general folder - Windows Kits\10\bin\, you may copy rc.exe, rc.dll there from bin\10.0.15063.0\ (from \x86 to \x86, from \x64 to \x64).

This is inconsistency in VS2015 / Win 10 SDK install.

2) If you put actual rc.exe path into the Project Properties > Configuration Properties > Executable Directories, at the end, it is generally safe. Paths are iterated from left to right, and the last one will be searched only if .exe was not found in the previous predefined ones.

3) VS may build .rc resource files always with 32-bit rc.exe from \x86 folder, depending on the variable in Executable Paths. It may be set to $(WindowsSDK_ExecutablePath). This actually should not matter, as these are 32-bit / 64-bit versions of the compiler executables with equivalent functionality. You can track which compiler .exe files MSBuild invokes in Output window, if increase verbosity: Tools > Options > Projects and Solutions > Build and Run > MSBuild project build output verbosity > Detailed.