Fix for ‘rc’ is not recognized and “Error while building when executing step “Make” (Full Fix)

Facts:
Windows 10 OS
QT Creator Version 5.11 installed
Visual Studio 2015 installed
Running under local administrator account

The Issue:
Building QGC fails to build, and a few errors occur. The errors are:
“‘rc’ is not recognized as an internal or external command, operable program or batch file.”
And at the end of the log
“Error while building/deploying project qgroundcontrol (kit: Desktop Qt 5.11.3 MSVC2015 32bit)
When executing step “Make””

The first error “‘rc’ is not recognized as an internal or external command, operable program or batch file.” is where the problem is. This error is referring to rc.exe. Qt Creator is just an editor it does not know where the compilers are or in this case, the Microsoft SDK Resource Compiler. After you see the rc is not recognized error, as a test open a command prompt with admin privileges and type in rc.exe then press enter. You will see the command is not found. For use in the fix later redirect the PATH statement to a text file. The command is:
Echo %PATH% >> c:\Path.txt
The reason the command was not found is because the vcvarsall.bat file that runs from Qt Creator did not create the proper path for rc.exe . The vcvarsall.bat edits the systems PATH statement with the paths for all kinds of things but not for rc.exe.

The Fix:
From within QC Creator load the qgroundcontrol project. After it loads select Tools > Options. In the Kits tab select the kit being used for QGC. In my case the kit is Desktop Qt 5.11.3 MSVC2015 32bit (default). Once you select the kit, look down below the compilers for the kit will be listed. In my case both compilers are the same C and C++ are Microsoft Visual C++ Compiler 14.0 (x86), make note of what yours are.

Select the Compilers tab and select the Compiler being used by the kit. When you select a Compiler from the list it will show the Initialization files path and parameters for the Compiler below. The full Initialization path will include a parameter passed to the vcvarsall.bat batch file. This is my full path:
C:\Progam Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat x86
That batch file is used to setup the environment to for all of the Microsoft compilers needed by the project, but in this case it did not get the path setup for rc.exe.
Find the x86 version for the rc.exe file on your system. You now have two choices for a fix. Edit the systems path with a good location for the rc.exe file or copy rc.exe and rcdll.dll to a good path location. Use the Path.txt file to select the path you want to copy the files into. In my case I copied rc.exe and rcdll.dll from: C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86 to
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin

I was able to get the build to complete after putting this fix in place.

1 Like