Error when trying to build QGC

Hi all,

After following the guide: https://dev.qgroundcontrol.com/en/getting_started/
i opened up the qgroundcontrol.pro file in qt creator and tried to build and run the code, however i keep coming up with these errors

error: C2220: warning treated as error - no ‘object’ file generated

and

:-1: error: Failed to retrieve MSVC Environment from “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat x86”:
The command “C:\Windows\system32\cmd.exe” could not be started.

Is there any simple way i can rectify this? Appreciate if anyone could help me out!

Does the path to vcvarsall.bat on you computer not exist? If so how does it differ?

Hi Don,

the vcvarsall.bat exists in the path, this error doesnt appear everytime though

However, the error C2220 still pops up everytime i try to compile it…

Update:

Just tried compiling again and it shows this error

Take a look at Compile Output tab instead which should provide more context as to where this is coming from

Thanks for the quick replies!
It seems the error comes from;
Cannot find file: QMAKE_CXXFLAGS.
and
Cannot find file: \WX.

but i am not very sure what that means…

First this is that released version of QGC use Qt 5.12.5, there is a Qt bug in 5.12.6 which will prevent vehicle connections. This was found at the last minute and the docs are still catching up. That said I doubt this would cause this problem.

Why qmake is failing I can’t sat. My only guess is that there may be a problem with non-video builds. You don’t have the video streaming depencies installed. Try installing those.

My apologies, the qmake error was because there was an additional argument.
After building it again, it shows:

C2220: warning treated as error - no ‘object’ file generated
and
C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss


The compile output just shows the elapsed time

Ah, interesting. We don’t see that in our CI runs. So specific to OS setup. I’ll remove that.

Is there a fix for error C2220 and C4819? Still cant build so far…
One of it involves QGCTileCacheWorker.cpp line 719

Just remove the comment which has the bad character in it

I just tried deleting all the files and building the source code all over again.
error C2220 still stands but im also getting a new error:

C:\Users\User\Desktop\Github\ardupilot\qgroundcontrol\custom\src\CustomPlugin.cc:206: error: C2259: ‘CustomVideoReceiver’: cannot instantiate abstract class

My guess for the previous errors was because i had the deafult Qgroundcontrol installed on my system as well so the build was affected (now deleted but having the above errors)

Any idea on how to fix?
error: C2259: ‘CustomVideoReceiver’: cannot instantiate abstract class

There may be bugs in the custom example since that is not built in CI. Please file a GitHub issue on that and we’ll get it fixed

Hi, i have an idea about the reason why there is no building problem with video-build but have building issue(C2220 and C4819) on non-video-build.

If the video streaming is enabled(gstreamer installed), qmlglsink.pri will be included. And qmlglsink.pri will set QMAKE_CXXFLAGS_WARN_ON to empty, which result the /WX flag(C2220) been removed, and in turn no warning treated as error.

And indeed, the real reason is what C2220 and C4819 indicated - building the QGC with some bad character in source files can not be represented in some code page(like 932). So remove the bad chars are the right way to go.

@kemen209 Can you enter a GitHub issue with the details on this including how to reproduce the build failure and I’ll fix it.

I am facing an error, Kindly help me fix:

Error while parsing file /home/rokit/qgroundcontrol/qgroundcontrol.pro. Giving up.
Project ERROR: License check failed! Giving up …

@NectroX ,Hello, I have the same problem with you. Have you solved the problem? How did it work out?