Compile a Qt project from command Line

If compiling an existing project, qmake -project is actually wrong, see "qmake --help".

qmake -makefile
make

If its a large project, "make -j4" or similar.


Thanks for the tips guys. I realized what I was doing wrong. QT-Creator actually takes the first two steps silently.

  1. Create the build output directory
  2. CD to the build output directory (KEY STEP)
  3. Call qmake referencing the .pro file
  4. Call make

So, the key thing that I overlooked was that you had to be in the build directory first and then call qmake, make etc... And also if the build already has the files compiled it throws that error. I just have to make sure I clean the build directory to compile everything fresh.


In terminal window

  • cd ~/your_project_folder/
  • qmake -project
  • qmake
  • make

Tags:

C++

Qt

Qt Creator