I wrote a little program in C++ using Qt. Back when it was Qt4, in order for my friends to compile my program on their Ubuntu system, I would tell them, after getting my source files, to just run:

sudo apt install libqt4-dev
<navigate to sources directory>

Now that it is Qt5, I read somewhere that the new libqt4-dev is qtdeclarative5-dev so I told them to just type the code above with qtdeclarative5-dev instead of libqt4-dev. However qmake didn't work, it did: qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory. I quickly found a fix by appending -qt5:

sudo apt install qtdeclarative5-dev
<navigate to sources directory>
qmake -qt5

Is this the correct way to do this? Is there a lighter or quicker Qt install?


Correct way to compile using only qmake command. You can install qt5-default package to set qt5 as default while using development binaries.

sudo apt-get install qt5-default qtdeclarative5-dev
  • "Your program was written in qt4 so it was searching qt4 binaries in system": Actually no, I have obtained the same error with another program written in Qt5. I don't know why it tried to compile with qt4.
    – Seub
    Dec 1 '18 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.