Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 708
Robin Avatar asked Apr 06 '17 15:04

Robin


2 Answers

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.

like image 178
Spock77 Avatar answered Nov 19 '22 04:11

Spock77


Not the cleanest solution but here's how I solved it, as @Alexey said, I also have 2 SDKs, 10 and 8.1 and probably that's where the error came from. I just added the path:

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

to the PATH in Windows environment variables enter image description here

Note: The x64 at the end of the path, needs to be changed if you are compiling for a different architecture.

In addition, the path is where the rc.exe is located on my PC, you should make sure that it is indeed in the same place on your PC as well.

Do not forget to close and reopen Visual Studio after the change to update the environment variables.

like image 1
Yinon_90 Avatar answered Nov 19 '22 04:11

Yinon_90