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: http://qt.nokia.com/downloads,
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:
src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared

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



References:
http://tom.paschenda.org/blog/?p=28
http://www.qtforum.org/article/31561/error-when-building-libraries.html
http://dcsoft.wordpress.com/2010/01/30/how-to-setup-qt-4-5-visual-studio-integration/
http://docs.google.com/viewer?a=v&q=cache:3e0M85Vdd3wJ:portfolio.delinkx.com/files/Qt.pdf+qt+visual+studio&hl=en&gl=us&pid=bl&srcid=ADGEEShHdqxYfPWGn-PCxWty0Z9ehLVLaPv-qlpDeaLAlcohpIxHFWMw-PqM4N5euTpmRrxOA5fSX8l6KJZmq-ttAfPgNqt8io-kjHQt5j3RWQgySF5MFnXGeXufW6jEipZCRVuZ8yqA&sig=AHIEtbRYvPmPZUfMm1fb0SVKaSjfYX_BVg

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.