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.

2 Likes

I keep getting the following build error in Qt Creator when trying to compile. I have followed the development settings exactly on the QGroundControl dev page.

https://dev.qgroundcontrol.com/master/en/getting_started/

19:20:48: Running steps for project qgroundcontrol...

19:20:48: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe" 
C:\Qt\5.12.6\msvc2017_64\bin\rcc.exe -name qgroundcontrol "C:\Users\Documents\\rover_code\qgroundcontrol\qgroundcontrol\qgroundcontrol.qrc" -pass 1 -o C:/Users/Documents/rover_code/qgroundcontrol/build-qgroundcontrol-Desktop_Qt_5_12_6_MSVC2017_64bit-Debug/rcc/qrc_qgroundcontrol.cpp
C:\Qt\5.12.6\msvc2017_64\bin\rcc.exe: File does not exist '/Documents/rover_code/qgroundcontrol/build-qgroundcontrol-Desktop_Qt_5_12_6_MSVC2017_64bit-Debug/rcc/qrc_qgroundcontrol.cpp'
jom: C:\Users\Documents\rover_code\qgroundcontrol\build-qgroundcontrol-Desktop_Qt_5_12_6_MSVC2017_64bit-Debug\Makefile [rcc\qrc_qgroundcontrol.obj] Error 1

19:21:07: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project qgroundcontrol (kit: Desktop Qt 5.12.6 MSVC2017 64bit)
When executing step "Make"

19:21:07: Elapsed time: 00:19.

In my case I have multiple SDK installed and to fix it I have to create add PATH to this rc.exe of latest SDK: like: C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86