Configuring Qt

From CSWiki
Jump to: navigation, search

Installing Qt

Qt works pretty much out of the box for compiling and linking purposes. If you don't want to install it in the default directory (/usr/lib/Trolltech/Qt-xxx), use the following configure command (for example, for Qt 4.1.4):

./configure -prefix /usr/lib/qt-4.1.4/

Environment Variables

For some Qt programs to work properly (designer, for example) you must have exported QTDIR and LD_LIBRARY_PATH like so:

export QTDIR=/usr/lib/qt-4.1.4


Also, add QTDIR/bin to your PATH:

export PATH=$QTDIR/bin:$PATH

You may also want to specify your qmake make-spec so you don't need to use -spec. On windows, this is usually something like


Note that the value must be an absolute path, not just the "win32-msvc2005" part.

Visual Studio Support

In order to make Qt support MS Visual Studio .NET 2005, an unofficial patch is required. Download the patch from Install Qt as follows:

  • Unpack the qt open source sources to C:\Qt\4.2.2.
  • Unpack into C:\Qt\4.2.2\.
  • From within the Visual Studio Command Prompt, not from cmd.exe (Tools->Visual Studio 2005 Command Prompt from inside Visual Studio), call:
       qconfigure msvc2005
  • If required, to start over, type
    nmake distclean
    and then re-run
    . (Note: you must not call configure.exe; rather use qconfigure.)