Labels

Friday, October 7, 2011

set up QT with Visual Studio environment

http://qtnode.net/wiki/Qt4_with_Visual_Studio#Setting_up_your_environment

how to set windows environment variable
http://www.itechtalk.com/thread3595.html

Environment Variables

In order to successfully use Qt three environment variables have to be setup: QTDIR, PATH and QMAKESPEC.
In order to compile Qt, the QTDIR has to be set to point at the directory containing the Qt distribution.
i.e. C:\Source\Qt\4.7.3\

To be able to invoke the Qt tools from the command line the PATH variable needs to be set. Simply include      %QTDIR%\bin  at the end of your PATH on windows.

In order to use qmake properly,  QMAKESPEC points at a directory holding file qmake.conf which     describes the target environment to qmake. i.e. C:\Source\Qt\4.7.3\mkspecs\win32-msvc2008 (for visual studio 2008).

QMAKESPEC

qmake requires a platform and compiler description file which contains many default values used to generate appropriate Makefiles. The standard Qt distribution comes with many of these files, located in the mkspecs subdirectory of the Qt installation.

The QMAKESPEC environment variable can contain any of the following:
  • A complete path to a directory containing a qmake.conf file. In this case qmake will open the qmake.conf file from within that directory. If the file does not exist, qmake will exit with an error.
  • The name of a platform-compiler combination. In this case, qmake will search in the directory specified by the mkspecs subdirectory of the data path specified when Qt was compiled (see QLibraryInfo::DataPath).


In summary, a cross-platform Qt project consists of the following files:
  • A .vcproj file containing Windows-specific settings and listing the files in the project.
  • A .pro file containing Unix and/or Mac OS X specific settings.
  • A .pri file (a qmake include file) listing the files in the project.
execute this command in your console:
qmake -tp vc -r xxxxxx.pro

No comments:

Post a Comment