Qt correct setup for QMAKESPEC, QTDIR and PATH

When you want to use different configurations for different platforms in your .pro file, it’s necessary to correctly setup three variables: QMAKESPEC, QTDIR and PATH.

Here is how to configure for different platforms:

Microsoft Windows:

In SystemPropertes -> Enviroment variables add/update following values:

QTDIR = P:\QT\4.7.0
PATH = %QTDIR%\bin
QMAKESPEC=%QTDIR%\mkspecs\win32-msvc2005
LANG = en_US

Unix Bourne shell: (not tested)

QMAKESPEC=/usr/local/qt/mkspecs/linux-g++
PATH=$PATH:/local/qmake/bin
export QMAKESPEC PATH</pre>

Unix C shell: (not tested)

setenv QMAKESPEC /usr/local/qt/mkspecs/linux-g++
setenv PATH $PATH:/local/qmake/bin</pre>

Note

You can optionally use LANG variable to setup QtCreator language.

Old qt 3.0 guide: http://doc.trolltech.com/3.0/qmake-guide.html
How to configure enviroment: http://doc.qt.nokia.com/4.0/qmake-environment-reference.html

2 comments

  1. Thank you!! I have been strugeling with a problem form 7h and this helped. I’m very grateful.

  2. The convention with Qt 5 is Qt in a compiler-specific folder like P:\QT\MAJOR.MINOR.PATCH\COMPILER_SPEC, or omitting the patch number.

    For example, the Windows QTDIR would be specified:
    QTDIR=P:\QT\4.7.0\msvc2005
    or
    QTDIR=P:\QT\4.7\msvc2005

Leave a Reply

Your email address will not be published. Required fields are marked *