Problem Building QGC in Visual Studio using QT

Hello.

Me and my group of students are trying to install the QGC to make our own interface above it. We are using Visual Studio 2017/2019 and have QT installed. We are getting a lot of errors such as CMake errors and also QTresources not being found.

Can someone help us out so we can continue? :slight_smile:

We are also having an error about an QGroundControl.rc file missing that is being requested by line 204 in the file CMakeList.txt.

Thanks for the trouble :slight_smile:

tl;dr: having trouble setting up the QGC from Getting Started with source & builds · QGroundControl Developer Guide on Visual Studio.

Hi @Mina,

Have you followed the getting started instructions exactly?
QGC has very strict build requirements, so if you’re using an incorrect version of Visual Studio or Qt it likely won’t work. Also make sure you’ve updated the submodules in your cloned source directory, otherwise some of the required code will be missing.

If I’ve got some time tomorrow I’ll see if I can spin up a Windows VM and get building set up. Otherwise I’ll try to check early next week :slight_smile:

QT we have the required 5.12.6 and the components we have selected are MSVC 2017 64 BIT, QT Charts, QT sources, Android ARMv7 (even tho we most likely won’t make Android version). And with Visual Studio we use the latest update on the 2017 one (15.9.4). With Visual Studio we also tried the 2019 one, again with the latest version (16.5.4).

We’ve also done the update for the submodules with the recursive command and fetched / pulled the master branch after that.

We managed to get a version running on QT Creator, but since this requires paid license it’s not suitable for our project.

Should I post the entire output we get when attempting to run? :slight_smile:
Also thank you for replying so quick, as always. You’re great help.

edit; Added the Visual Studio Versions of both 2017 and 2019.

It may be possible to use Qt Creator without a paid license, depending on how you’re presenting and structuring your application.

You can, although if it’s possible to post just the errors and warnings that may be easier for us to make sense of (at least initially). Whatever output you choose to post, please do so in a code block so it’s a bit easier to copy and/or navigate :slight_smile:

Okay so big update! A teacher walked by and he asked us how it’s going and we told about our issue. He kinda confirmed the same as you did; that QT Creator is useable without a paid license and he showed one of us how it’s used. He “magically” got it working and told us we can use that instead of Visual Studio! :smiley: (He is one of the guiding teachers for this project)

So no help needed anymore! We are now going to make a custom build (we already found the instructions on how to do that, I have faith it will go well :slight_smile: ).

Sorry for the inconvienence!

1 Like

Altho it might still be interesting for others to solve the issue if they want to use Visual Studio

Severity	Code	Description	Project	File	Line	Suppression State
Error		CMake Error at C:\Users\Mintie\source\repos\qgroundcontrol_test\qgroundcontrol\CMakeLists.txt:123 (find_package):
  Could not find a package configuration file provided by "Qt5" (requested
  version 5.15.0) with any of the following names:

    Qt5Config.cmake
    qt5-config.cmake

  Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
  to a directory containing one of the above files.  If "Qt5" provides a
  separate development package or SDK, be sure it has been installed.	QGroundControl	C:\Users\Mintie\source\repos\qgroundcontrol_test\qgroundcontrol\CMakeLists.txt	123	

This is the current error we have affter some of our own trouble shooting.
We found that sudo apt-get install qtbase5-dev is being suggested but we use Windows and have no clue how to do it for Windows.

edit; It does say 5.15.0 here but that was required for QT Creator, we got this error at 5.12.6 as well.

Great to hear! :slight_smile:

Generally that’s solved by specifying the place where Qt is installed in your build configuration command. Assuming you’re using the Build using cmake on CLI instructions, I’d guess you’re running into this on step 3, and could solve it by calling something like the following:

qmake ..\ -DQt5_DIR=C:\Qt\5.12.6\msvc2017_64\lib\cmake\Qt5

We discussed this via DM and seem to have solved the issue.

Installation Instructions

The latest master was updated to Qt 5.15 very recently, and the build docs unfortunately haven’t yet been updated to match. On a fresh Windows machine, the steps I took were as follows:

  1. Downloaded and installed git
  2. Downloaded and installed Visual Studio Community 2019 64-bit
  3. Downloaded and installed the “Desktop Development with C++” compiler
  4. Downloaded and run Qt Online Installer
  5. Downloaded and installed Qt 5.15.2 MSVC 2019 64-bit, and Qt Charts (I don’t need to build for Android)
  6. Downloaded and done the “Complete” install for both gstreamer and gstreamer-devel msvc-x86_64-1.18.1 64 bit
  7. Git cloned the sources of the qgroundcontrol repo and updated the submodules
  8. Opened Qt Creator
  9. Gone to File/Open and navigated to qgroundcontrol\qgroundcontrol.pro
  10. Configured it as Qt 5.15 MSVC 2019 64-bit
  11. Pressed the green play button to build and open

Perhaps of particular note are steps 8 through 11. Visual Studio (from step 2) is ONLY used for getting the relevant compilers (step 3). Actually building QGC should be done through Qt Creator.

Old Versions

If you for some reason happen to want to build an old version (instead of working off the latest master) then the relevant changes are

  1. Downloaded and installed Visual Studio Community 2017 64-bit (requires making a free account)

  1. Downloaded and installed Qt 5.12.6 MSVC 2017 64-bit, and Qt Charts (Android ARMv7 optional)

  1. Clone the sources, but checkout the desired commit/tag/branch before updating submodules - f2d0b8c is the last commit the day before the Qt 5.15 changeover, and v4.1.4 is the last tag before it

  1. Configured it as Qt 5.12.6 MSVC 2019 64-bit
    for the old Qt 5.12.6 option)
1 Like

To anyone interested, I’ve submitted an issue to the QGC developer docs repo that the build instructions should be updated:

1 Like