简体   繁体   中英

Is there a way to run qmake with QT 5.7 and above?

I have a project I made with Qt 5.7 in QtCreator, but now I would like to be able to build the project with qmake in the terminal rather than through QtCreator. However, I can't get qmake to run with Qt 5.7.

Following the instructions in this webpage , I can switch qmake to qt5 but qmake -v still says I'm running QT 5.2.1. How can I switch this to Qt 5.7?

Edit: Adrien's second comment worked. I was unable to get qmake to switch to Qt 5.7, but I can simply directly call the qmake that came installed with Qt 5.7 like this:

/home/<user>/Qt5.7/Qt5.7.0/gcc<something>/bin/qmake

Short answer: yes of course :)

Each Qt build builds its own qmake binary. So if you already built/installed Qt 5.7, it means you are simply pointing to your previous Qt version's qmake. You can access any Qt version qmake executable from your Qt install folder, ie for Linux:

/home/<user_name>/Qt/Qt<version>/<compiler>/bin/qmake

Note that the path to Qt folder, and its name may vary depending on the settings you used for the first installation.


If you want to use a global setting instead, and if qtchooser -list-versions lists the Qt version you want to use, then make sure to set export QT_SELECT=<Qt version> (without spaces) in the same terminal as the one you use qmake from afterward. Environment variables are not kept when you close your terminal, or shared between different terminals.

export QT_SELECT=qt5
qmake

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM