Complete noob right here, I'm learning c++ and I saw some tutorial somewhere with instructions to compile the Qt application example from the command line, then I noticed the path from the tutorial was not correct, I want to learn how to compile Qt from command line, and maybe even do some makefiles to automate the process, at least I want to get started ...It seems like the qt libraries are already installed within my system since it is using the KDE desktop environment, but I don't know how should I link or what paths should I include as arguments. Please guide me, remember I'm a complety noob but I really want to learn. This is the tutorial I'm talking about http://zetcode.com/gui/qt5/introduction/
Asked
Active
Viewed 1,399 times
-3
-
Do you want to compile an application *using* Qt or do you want to compile Qt *itself*? That's not entirely clear to me from your question. – Jesper Juhl Jul 01 '16 at 16:13
-
A Qt application without needing QtCreator or any other tool, just command-line. – angelojulioth Jul 01 '16 at 16:23
-
Do you have Qt tools installed? You can get those from your distro. Try running this command to test if you have qmake, and see which version of Qt: qmake -query – hyde Jul 01 '16 at 19:40
-
I do, actually, it seems that QtTools and base libraries come as a default for distros with a KDE desktop, I have qmake installed, actually I just installed the Qt's newest version -5.7-. It installed in my home folder as a default, I was fearing I could break something if I changed the path, now I just need to now how to add the path to Qt's binaries installed locally and using them from the command line instead of the binaries that came as default. How does it works if two binaries used by $PATH share the same name? – angelojulioth Jul 02 '16 at 09:59
1 Answers
1
When you build, Qt Creator does three things only: it invokes qmake
, then make
, then runs the target. That's all.
Suppose your project is in ~/src/project
. Here's how you would build it properly using a shadow build folder:
$ mkdir -p ~/src/project-build
$ cd ~/src/project-build
$ qmake ~/src/project
$ make -j

Kuba hasn't forgotten Monica
- 95,931
- 16
- 151
- 313
-
Thanks, I'll try to research more, I was checking dependencies from the qt5-base package, I searched for the binaries and I saw qmake, then I executed qmake with the help argument and it seems that QtCreator uses that to create a project and keep track of the source files being used, just two more questions, does it uses libraries from the GCC compiler if I include them in a QtProject? Does it actually run make to compile or everything is done with qmake? – angelojulioth Jul 02 '16 at 09:51
-
@angelojulioth qmake is **not** used by Qt Creator to generate project files; Qt Creator comes with its own templates. The `.pro` file is fed to qmake to generate a makefile, and the makefile is then used to build the project. `qmake` is a makefile generator **only**. When run from the command line, you could coax it into generating a skeleton project file, too, but you wouldn't do that often if at all. – Kuba hasn't forgotten Monica Jul 06 '16 at 13:16