[ZZ]How To Compile Qt 4.7 with Visual Studio 2010
2011-12-01 10:31
211 查看
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).
This post is a step-by-step guide on how to compile Qt 4.7.1 with MSVC 2010.
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
compilation.
Visual C++ 2010 contains all necessary SDKs for Qt compilation. However if you plan to use Qt with Phonon you need to install additional software from Qt
for Windows Requirements list.
Download and extract Qt 4.7.1 Source Code.
Copy contents of the folder
Set up environmental variables
Update
Download the latest version of jom.
Extract jom files to
Start Visual Studio 2010 Command Prompt:
Run following commands in it (every line is a different command: type it then press
Download and install Qt Visual Studio Add-in.
Run Visual Studio 2010. Integrate just compiled Qt to IDE using menu
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)
Remarks.
*Jom is nmake replacement for Qt compilation on multi-core CPU. Its parameter
**Do not forget to use
This post is a step-by-step guide on how to compile Qt 4.7.1 with MSVC 2010.
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.
Visual C++ 2010 contains all necessary SDKs for Qt compilation. However if you plan to use Qt with Phonon you need to install additional software from Qt
for Windows Requirements list.
Download and extract Qt 4.7.1 Source Code.
Copy contents of the folder
qt-everywhere-opensource-src-4.7.1to the directory where you intend to install Qt. In our case this is
C:\Qt\4.7.1.
Set up environmental variables
QTDIR=C:\Qt\4.7.1 QMAKESPEC=win32-msvc2010
Update
PATHvariable to include
%QTDIR%\bin
Download the latest version of jom.
Extract jom files to
C:\Qt\jomfolder
Start Visual Studio 2010 Command Prompt:
Start > Programs > Microsoft Visual Studio 2010 > Visual Studio Tools > Visual Studio Command Prompt.
Run following commands in it (every line is a different command: type it then press
Enter):
cd c:\Qt\4.7.1 configure -debug-and-release -opensource -platform win32-msvc2010 ..\jom\jom.exe -j 4
Download and install Qt Visual Studio Add-in.
Run Visual Studio 2010. Integrate just compiled Qt to IDE using menu
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)
Remarks.
*Jom is nmake replacement for Qt compilation on multi-core CPU. Its parameter
-j Nallows to setup number of parallel processes for compilation. Number of physical CPU cores is good choice for
N.
**Do not forget to use
/dswitch 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.
相关文章推荐
- How To Compile Qt with Visual Studio 2010
- How To Compile Qt with Visual Studio
- How to compile WinPcap with Visual Studio 2010?
- How to compile Tensorflow with SSE4.2 and AVX instructions?
- How To Add QML Module with Plugins for Qt Creator
- How to compile TLD with Win7-64bit + matlab2013b-64bit + VS2012 + OpenCV3.0
- How to use http cookies with Qt
- How to develop applications with Qt Mobility based on Symbian device
- How to Install Eclipse IDE with C/C++ and Qt V4.7.2 (OpenGL included)
- QT18 how to link QListView with sqlite Database values
- how to deal with "no such file error or diretory" error for a new programmer in QT creator
- How to Export Mailboxes with Exchange Server 2010 SP1(带状态查看,清除请求,归档备份)
- Exch UM: How to integrate Exchange 2010 (or 2007) with Trixbox 2.8
- QT19 How to link QComboBox with sqlite Database values
- how to reveal in finder or show in explorer with qt
- 如何利用QT在terminal终端执行ROS系统中的roslaunch命令(How to launch a roslaunch in Qt with a terminal (GUI) )
- Q_WS_X11 Doesn't compile with gcc 4.5.1/Qt 4.7
- How to get started with Cute Editor(zz)
- How to compile a C/C++ DLL for 64 bit with Visual Studio?
- How_to_build_a_static_Qt_version_for_Windows_with_gcc | Qt Wiki | Qt Developer Network