Friday, August 13, 2010

Visual Studio and Qt.

In this post we will explain how to get Qt installation for visual studio.

1. Download Qt source code. This is currently available in the nokia website:,
Unzip the file into e.g. c:\qt\4.6.1-vc. Important to use a path with no embedded spaces, as the Qt build tools have problems with them.
Install the SDK completely. Install also the plugin for Qt in visual studio.

2. Add these 3 paths to the Environment Variables: “C:\Qt\2009.01\bin” ,
“C:\Qt\2009.01\qt\bin” and \VC\bin .

3. Run the Visual Studio Command prompt. Start > Program Files > Visual Studio > Visual and go to the Qt installation directory. Type vcvars32.bat.
This will create the environment variables required for the next step. The batch file resides in the VC\bin directory of your Visual Studio installation.

4. Type configure -platform win32-msvc2008. (will take a long time)
This will tell Qt to prepare itself for being compiled by the Visual Studio compiler. Again, if you use another version of VS than 2008, replace win32-msvc-2008 with the makespec appropriate for you. We need to this, because the prebuilt binaries that come with the Open Source Qt distribution for Windows cannot be used by the Visual Studio compiler.So to fix this, we have to build those files from the Qt sourcecode using the Visual Studio compiler.

5. Type nmake (will take even longer)

6. It will stop after a LONG while with an error

7. Delete all the instances of mocinclude.tmp, they are usually in:

8. Run nmake again

9. Go to your qt app and run qmake –t vcapp

10. This should create a sln for the project

You should now be able to build your Qt project in visual studio


1 comment:

Anonymous said...

Hola, una pregunta ¿tienes twitter?, deberías crear una cuenta y ligar tu blog al twitter, me parecen muy interesantes tus aportes, saludos desde algún lugar de méxico...

some guy.