Usual way of installing Qt for Visual Studio is to download already compiled binaries from Nokia website. However binaries for the latest Visual Studio 2010 are not available (on the moment of the writing). html
This post is a step-by-step guide on how to compile Qt 4.7.1 with MSVC 2010. web
18 July 2011: This guide also works for Qt 4.7.3 and even for Qt 4.8. Just replace version number where applicable.
14 August 2011: In order to build Qt for 64 bits just use Visual Studio x64 Win64 Command Prompt (2010)
in step 8. Also install Service Pack 1 for Visual Studio 2010 beforehand – it fixes few bugs related to x64 compilation.app
qt-everywhere-opensource-src-4.7.1
to the directory where you intend to install Qt. In our case this is C:\Qt\4.7.1
.QTDIR=C:\Qt\4.7.1
QMAKESPEC=win32-msvc2010
PATH
variable to include %QTDIR%\bin
C:\Qt\jom
folderStart > Programs > Microsoft Visual Studio 2010 > Visual Studio Tools > Visual Studio Command Prompt
.Enter
):cd c:\Qt\4.7.1
configure -debug-and-release -opensource -platform win32-msvc2010
..\jom\jom.exe -j 4
Qt > Qt Options > Qt Versions > Add
Usually compilation takes about 10 hours, but thanks to jom and Intel SSD drive it took only 2 hours 40 minutes on my machine (Windows 7, 64bits)ide
Remarks.
*Jom is nmake replacement for Qt compilation on multi-core CPU. Its parameter -j N
allows to setup number of parallel processes for compilation. Number of physical CPU cores is good choice for N
.post
**Do not forget to use /d
switch if you want to change drive in command prompt, e.g: cd /d d:
. Usual cd d:
does not work anymore – a little 「surprise」 from Microsoft.visual-studio