Qt Creator Documentation

Setting Up a qmake Project

The qmake tool helps simplify the build process for development projects across different platforms. qmake automates the generation of makefiles so that only a few lines of information are needed to create each makefile. qmake can be used for any software project, whether it is written in Qt or not.

The qmake tool generates a makefile based on the information in a project file that is generated by Qt Creator. It can generate makefiles for MinGW, Microsoft Visual studio, and CSL ARM in Windows, and GNU Compiler Collection (GCC) in Linux and Mac OS X.

For more information about qmake, see the qmake Manual.

Selecting the Qt Version

Qt Creator allows you to have multiple versions of Qt installed on your development PC and use different versions for each of your projects.

If Qt Creator finds qmake in the PATH environment variable, it uses that version. The qmake version of Qt is referred to as Qt in PATH. If you intend to use only one version of Qt and it is already in the PATH and correctly set up for command line use, you do not need to manually configure your Qt version.

Compiling Projects with MinGW in Windows

To add a Qt version for MinGW:

  1. Select Tools > Options... > Qt4 > Qt Versions.
  2. Click and enter the name of the version in the Version name field.
  3. Enter the qmake binary path in the qmake location field.
  4. Enter the MinGW installation path in the MinGW directory field.

Troubleshooting MinGW Compilation Errors

If error messages displayed in the Compile Output pane contain paths where slashes are missing (for example, C:QtSDK), check your PATH variable. At the command line, enter the following commands:

 where sh.exe
 where make.exe
 where mingw32-make.exe

If these commands show paths, they have been added to the global PATH variable during the installation of a toolkit based on Cygwin or MinGW, even though this is against Windows conventions.

To keep working with the third-party toolkit, create a new shell link that adds the required paths (as Visual Studio and Qt do). The shell link must point to cmd.exe, as illustrated by the following example:

C:\Windows\System32\cmd.exe /K C:\path_to\myenv.bat

where the /K parameter carries out the command specified in the bat file.

Create the myenv.bat file at path_to, which should be in a convenient location. In the file, specify the paths to the toolkits. For example,

set PATH=C:\path1;C:\path2;%PATH%

where path1 and path2 are paths to the toolkits.

Finally, remove the paths from the global PATH, reboot the computer, and run the where commands again to verify that the global PATH is now clean.

You can use the shell link to run the tools in the third-party toolkits.

Compiling Projects with Microsoft Visual C++

To add a Qt version for a Microsoft Visual C++ compiler:

  1. Select Tools > Options... > Qt4 > Qt Versions.
  2. Qt Creator automatically sets the correct environment variables for compilation. Select the internal version number of the installed Microsoft Visual C++ tool chain in the Toolchain list.

  3. If the Debugging helper is not in use, click Rebuild to take it to use. For more information, see Using Debugging Helpers.

Compiling Qt for Symbian Projects

If you are using Qt for Symbian and your Symbian SDK is registered with devices.exe, Qt Creator automatically detects the Qt version. To add a Qt for Symbian version:

  1. Select Tools > Options... > Qt4 > Qt Versions.
  2. Select the S60 SDK you want the Qt Creator to use.

  3. To build an application for your device using GCCE, enter the path to the CSL ARM toolchain directory in CSL\GCCE Directory.

    You do not need to specify this path if the compiler is included in the PATH environment variable.

  4. To build an application for the emulator (WINSCW toolchain), enter the path to your Carbide C++ installation directory in Carbide directory.

    Note: You need to have Carbide C++ version 2.0 or later installed.

Compiling Projects With Linux

To compile a project in Qt Creator, Linux uses GNU Compiler Collection (GCC). Intel Compiler Collection (ICC) is supported as a drop-in replacement for GCC.

To add a Qt version:

  1. Select Tools > Options... > Qt4 > Qt Versions.
  2. Click and enter the name of the version in Version Name.
  3. Enter the path to the qmake binary in Path to qmake.

Compiling Projects With Mac OS X

To compile a project in Qt Creator, Mac OS X uses GNU Compiler Collection (GCC), which is part of Xcode.

To add a Qt version:

  1. Select Qt Creator > Preferences... > Qt Versions.
  2. Click and enter the name of the version in Version Name.
  3. Enter the path to the qmake binary in Path to Qmake.

[Previous: Opening a Project] [Next: Adding Libraries to qmake Projects]

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

s.parentNode.insertBefore(ga, s); })(); -->