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

export LD_LIBRARY_PATH=$QTDIR/lib

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

QMAKESPEC=c:\qt\4.3.1\mkspecs\win32-msvc2005

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 sourceforge.net. Install Qt as follows:

  • Unpack the qt open source sources qt-win-opensource-src-4.2.2.zip to C:\Qt\4.2.2.
  • Unpack acs-4.2.2-patch1.zip 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:
       installpatch42.bat
       qconfigure msvc2005
       nmake
  • If required, to start over, type
    nmake distclean
    and then re-run
    qconfigure.bat
    . (Note: you must not call configure.exe; rather use qconfigure.)