Search code examples
visual-studiovisual-studio-2022intel-fortranintel-oneapi

"rc.exe not found" with VS 2022 over and over again


My installation of Visual Studio 2022 somehow does not find my installed "rc.exe" files, even tough they are installed in the propper directories (e.g. C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86) in Lib and bin and under different version numbers. Thus I cannot build my fortran code. A c# Project in the same solution builds like a charm.

Two colleagues of mine and me installed VS2022 at the same time (some weeks ago) to port some code to a new developement of VS. One colleague had no problems at all with the standard settings of VS2022 and Intel oneAPI, the other colleague had some difficulties regarding rc.exe, but after installing his missing SDKs with the "Visual Studio Installer" he is good since.

Me on the other hand installed everything in standard settings and even have the rc.exe files in the corresponding folders but never managed to permanently get rid of the "rc.exe not found" error. I don't remember exaclty what I did the first time when I got rid of this issue, but I think I set the folders of the rc.exe as path in the system variables. Upon trying to import some other project into the solution (https://jacobwilliams.github.io/json-fortran/ or respectively https://github.com/jacobwilliams/json-fortran) somehow the rc.exe error returned, even after I deleted this project from the solution....desparate I installed some SDKs for Windows 11, even tough I am using Windows 10 and my colleagues are using SDK Version 10.0.19041.0, which I also have installed.

checkboxes

And after some random restarting of VS and the computer didn't help, it miraculously worked without an error on the next day.......some kind of magic....I don't know why.

After we did some changes to the code and I pulled some stuff before I commited my parts, I am now back to the "rc.exe not found" error....

Somehow this makes no sense to me and it seems, that my visual studio is not set up correctly. But since repairing and reinstalling did not solve the problem I am out of any clues what so ever.

These are some things I did.

  • set system variables to "path" where the rc.exe files are located
  • since the files are already in the right place copying them from somewhere else makes no sense
  • reinstalled Visual Studio 2022 and Intel oneAPI
  • repaired VS2022 several times

A hack another colleague gave me is starting VS via its console. Thus we created a bat with the following content

CALL "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" devenv

In this mode I do not get the error of missing rc.exe, but even tough this seems to solve my issue, I still would like to know what is wrong with my VS in the first place, since this is hack/workaround...


Solution

  • Even tough this is an intel issue, in Visual Studio go to

    Tools -> Options -> Intel Compiler and Libraries -> IFX Intel Fortran -> Compilers AND Tools -> Options -> Intel Compiler and Libraries -> IFORT Intel Fortran Classic -> Compilers

    click on "reset" and add the following path to "executables"

    C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64 or in your case C:\Program Files (x86)\Windows Kits\10\bin<>\x64

    this solved my rc.exe not found issue.