Difficulties getting .pro file built with Qt Creator 4.10.2

Post Reply
Horst0815
Posts: 19
Joined: Sat Oct 05, 2019 9:50 am
Real Name:

Hi everyone,
I tried to build the QLC+ sources (rev 4.12.2) by importing the .pro file into Qt Creator.
Since I am rather a newbie with the Creator, I am struggling to resolve the following include problem:
- when setting up the project, I was choosing the "Qt_5_12_6_GCC_64bit_Debug" kit -> so Qt Creator created some build folder "build-qlc-Desktop_Qt_5_12_6_GCC_64bit-Debug" at the same level as the sources (folder "qlcplus-QLC-_4.12.2").
- when processing the ".ui" files in qlcplus-QLC-_4.12.2/ui, the Creator made some "ui_*.h" files in the build order, e.g. for "aboutbox.ui" it created a header "ui_aboutbox.h" in the build sub-directory "Desktop_Qt_5_12_6_GCC_64bit-Debug/ui/src"
- since the build folder and its subdirectories are not included in my current .pro file, I am getting errors about unincluded header files.
What is the best way to resolve this issue?
Should I have chosen a different location for the build-directory (lets say, as a sub-folder of the directory containing the .pro file) or should I somehow include the build-folder (or some of its subdirectories) to my .pro tree? If the latter applies: As what kind of project should I add these (sub-)directories to my .pro tree?

I should mention that this is my first time operating with Qt Creator + Qt GUI elements (before I was mostly working with MS Visual studio + wxwidgets...).
Any help would be appreciated :)
User avatar
mcallegari
Posts: 4482
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Except for the fact that you didn't even mention on which OS you're trying to build, have you checked the build instructions in the GitHub wiki first?
https://github.com/mcallegari/qlcplus/wiki
Horst0815
Posts: 19
Joined: Sat Oct 05, 2019 9:50 am
Real Name:

Hi, I am sorry - I forgot to mention, I am using Kubuntu 18.04 LTS.
Yes I checked those instructions - my problem is not a missing package, I installed them all.
I think my problem is rather my missing experience with Qt Creator and including the ".h" files created from the ".ui" files, I would say...
Building only with the aid of the cmake toolchain works fine for me.
But my aim is to have CLC+ running with the Qt Creator GUI debugger attached to speed up development...
lightsbybrian
Posts: 7
Joined: Thu Apr 20, 2017 3:13 am
Real Name: Brian

Sorry to bump an old thread, but getting the build working within Qt Creator is still an area where "there be dragons."

Massimo, with respect, your wiki says nothing about how to get the build working with Qt Creator (or any IDE). I'm honestly curious how your own development environment is set up. I can hardly imagine you're only using text editors to lay out your UI elements, etc... Some words along those lines might be a nice addition to the wiki.

The wiki DOES mention that "out-of-tree builds are not tested and most probably do not work". This is the crux of the issue as I have finally discovered (out-of-tree builds definitely do not work). Qt Creator calls out-of-tree builds "Shadow build." In order to successfully build within Qt Creator, you must turn OFF "Shadow build." This is done by going to the Projects view, selecting the desired build task, and clearing the "Shadow build" checkbox. See screenshot below. Since I have three versions of the Qt libraries installed, I have three build targets. Your view will vary based on what Qt libraries you have installed.
qlc_qt_shadow_build.png
Unfortunately, this appears to be a setting that lives in the .pro.user file, which is rightly not something that should be in version control.

For the record, this advice is based on Qt Creator 4.14.2 on Debian 10.7 (Buster). I suspect it will be similar for nearby versions of Qt Creator on any platform.
User avatar
mcallegari
Posts: 4482
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

I use Qt creator to edit files, and a terminal to build the sources.
I don't see anything unusual about it.

Also, since you mention the wiki:

Code: Select all

Issue the following commands to start building QLC+:

cd qlcplus
qmake (see note above)
make
Where do you think those commands should be issues other than a shell?
lightsbybrian
Posts: 7
Joined: Thu Apr 20, 2017 3:13 am
Real Name: Brian

Where do you think those commands should be issues other than a shell?
The Build/Run buttons in QT Creator:
Screen grab of build/run buttons inside QT Creator.  Top to bottom: Select project configuration, run, debug, build.
Screen grab of build/run buttons inside QT Creator. Top to bottom: Select project configuration, run, debug, build.
Screenshot from 2021-07-29 14-19-33.png (6.23 KiB) Viewed 2834 times
As long as the project build steps are configured correctly (and by default they are, aside from the Shadow Build option), those buttons do precisely that -- run qmake, followed by make. As depicted in the project build settings:
Build steps, with custom step to collect built .so files into the root of the tree
Build steps, with custom step to collect built .so files into the root of the tree
Do you also invoke gdb and debug from the terminal? If you add some post-build steps to copy all the shared libraries into one convenient place and properly set the debug environment's library search path (these are all done via the QT Creator UI), then running and debugging QLC+ is completely possible without having to touch the command line*. Which, in my opinion, is the whole point of using an Integrated Development Environment.
Debug environment, showing addition of location to find the built libraries
Debug environment, showing addition of location to find the built libraries
I submit that it is not "typical" to use a terminal to build/run/debug while also using a full IDE to edit the code. Sure, you can do it that way, but that side-steps some of the very useful features of the IDE.

* - This also allows you to run and debug your development build while simultaneously maintaining a known-good build "installed".
Horst0815
Posts: 19
Joined: Sat Oct 05, 2019 9:50 am
Real Name:

Hi lightsbybrian - thanks for your reconsideration of this old topic :)
As I remember I found the hint to delete the user.pro file in some old Qt forum, but forgot to post it here, I think in addition there were problems with the folder structure (build/source/debug) when building it within the IDE. I stopped working on my project but might turn back within the next months, so all hints regarding "getting build and debugging working from IDE" are really welcome - as this is my usual workflow also in my company-related tasks.
PS: building it in the terminal was not a problem, but then I would not really need an IDE - especially the graphical debugger saves me alot of time and also makes debugging of certain crashes much easier. (but of course this is also always possible in a terminal)
Post Reply