Installing Qt for use with Visual Studio 2005

January 31, 2009

Things to know before you start:

The Qt package is large and requires approximately 500MB of disk space when it is completely built. During the the build process, the size of the package can become larger, approximately 750MB. You should make sure that you have enough disk space to accommodate the Qt package before installing it.

The build process is time consuming, 1-2 hours or longer, depending on the speed of your machine. It is best not to build the Qt package when you need to use your computer for another purpose.

This installation is not integrated into the Windows operating system, e.g. there is no install or un-install procedure to follow.

Uninstallation is accomplished by deleting the directory containing Qt.

Building Qt

Download the open source version of Qt from TrollTech (you want the version qt-win-opensource-src-4.4.3.zip) or you can download it from a local cache copy : qt-win-opensource-src-4.4.3.zip. This zip file is approximately 123 MB in size.

  1. "Extract all" the contents of the zip file to the directory that is to contain the Qt directory.

  2. The path to the Qt files cannot contain spaces. It is recommended that you rename and move (if required) the directory containing the unzipped files so that the path to the files has the form C:\Qt\4.4.3 (substituting another drive letter if you don't want to install it to the C: drive). All of the following instructions assume that directory containing the Qt files is C:\Qt\4.4.3.

  3. Add C:\Qt\4.4.3\bin to your path variable. This is accomplished by selecting My Computer”->properties->advanced->environment variables", select edit for the PATH variable, and then append to the end of the PATH variable the expression ;C:\Qt\4.4.3\bin The semi-colon is inserted at the beginning of this path to separate it from the existing paths in the PATH variable.

  4. Open Visual Studio 2005 Command Prompt. This program usually has a link in the Start/Programs/Microsoft Visual Studio 2005/Visual Studio Tools pull down menu. You can also invoke the command prompt window by opening up the Visual Studio IDE and selecting "Visual Studio 2005 Command Prompt" from the Tools menu.

  5. Cd to the directory containing the source files, C:\Qt\4.4.3 and configure your installation using configure.exe. The configuration command used to create the version of Qt in the PIC lab was

    configure.exe -debug -no-webkit -no-vcproj -no-phonon -no-phonon-backend

    To reduce the size of the installation, this only installs the debug version, and does not install the Web aware components (webkit) or multi-media support (phonon). You can see the options for the configure command by executing configure --help

    If you have cygwin or MinGW installed on your system, you may want to add the additional option

    -platform win32-msvc2005

    to force it to build for msvc2005. If you have another version of Visual Studio, you would change this option appropriately.

  6. With the completion of the configure command build the package by typing nmake. This part of the build process is the most time consuming and may take an hour or two (or longer).

  7. When nmake has finished. Check to see if things are working properly by typing "assistant" in the command prompt window. This should bring up the Qt documentation browser.

  8. Finish up your installation by executing the command nmake clean . This removes all of the intermediate files that were created during the build, but does not remove the executables or libraries created.