VS2010 安装与使用QT 4.7.4

Qt是诺基亚开发的一个跨平台的C++图形用户界面应用程序框架。它提供给应用程序开发者建立艺术级的图形用户界面所需的所用功能。Qt是完全面向对象的,很容易扩展,并且允许真正地组件编程。本文主要介绍了如何安装Qt4.7.3。具体使用的例子可在 Windows 7 64bit和Visual Studio 2010下安装及使用CGAL 3.8
一文中找到。
参考网站: http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/

 
    1).在 http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.zip下载Qt 4.7.3源代码包。注意这里我们要手动编译生成所有的库,而不是用安装文件简单安装。整个安装过程耗时在2小时以上。

      2).把下载到的 qt-everywhere-opensource-src-4.7.1压缩包解压的制定文件夹。注意,路径中不要包含空格等特殊字符!如C:\Qt\4.7.3

      3).在我的电脑中设置环境变量
              QTDIR=C:\Qt\4.7.3
              QMAKESPEC=win32-msvc2010
              然后在Path中添加%QTDIR%\bin

      4).在 ftp://ftp.qt.nokia.com/jom/下载最新版本的jom,这里笔者下载了jom106。把jom放到和Qt根目录平级的地方。如C:\Qt\jom

      5).打开VS2010的命令行窗口,进入C:\Qt\4.7.3文件夹。输入
              configure -debug-and-release -opensource -platform win32-msvc2010
              大概十分钟以内可以完成。注意,如果要编译32位库,就用普通的Visual Studio CommandPrompt。如果要编译64位库,就使用Visual Studio x64 Win64 Command Prompt。

      6).这一步耗时非常长。在我的电脑上用了1个多小时。
              在命令行窗口输入
              ..\jom\jom.exe -j 4

      7).经过漫长的等待,我们成功的安装了Qt 4.7.3。

      8).使用例子可见 Windows 7 64bit和Visual Studio 2010下安装及使用CGAL3.8一文。

国外博客原文

How To Compile Qt 4.7 with Visual Studio 2010

February 1,2011

Usual way of installing Qt for Visual Studio is to downloadalready compiled binaries from Nokia website. However binaries forthe latest Visual Studio 2010 are not available (on the moment ofthe writing).

This post is a step-by-step guide on how to compile Qt 4.7.1with MSVC 2010.

18 July 2011: This guide also works forQt 4.7.3 and even forQt 4.8.Just replace version number where applicable.

  1. Visual C++ 2010 contains all necessary SDKs for Qt compilation.However if you plan to use Qt with Phonon you need to installadditional software fromQt forWindows Requirements list.
  2. Download and extract Qt 4.7.1 Source Code.
  3. Copy contents of the folderqt-everywhere-opensource-src-4.7.1 to the directorywhere you intend to install Qt. In our case this isC:\Qt\4.7.1.
  4. Set up environmental variables
    QTDIR=C:\Qt\4.7.1
    QMAKESPEC=win32-msvc2010
  5. Update PATH variable to include%QTDIR%\bin
  6. Download the latest version of jom.
  7. Extract jom files to C:\Qt\jom folder
  8. Start Visual Studio 2010 Command Prompt:
    Start > Programs > MicrosoftVisual Studio 2010 > Visual Studio Tools> Visual Studio Command Prompt.
  9. Run following commands in it:
    cd c:\Qt\4.7.1
    configure -debug-and-release -opensource -platform win32-msvc2010
    ..\jom\jom.exe -j 4
  10. Download and install Qt VisualStudio Add-in.
  11. Run Visual Studio 2010. Integrate just compiled Qt to IDE usingmenu Qt > Qt Options

Usually compilation takes about 10 hours, but thanks to jom andIntel 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. Itsparameter -j N allows to setup number of parallelprocesses for compilation. Number of physical CPU cores is goodchoice forN.

**Do not forget to use /d switch if you want tochange drive in command prompt, e.g:cd /d d:. Usualcd d: does not work anymore – a little “surprise” fromMicrosoft.

参考链接:

http://blog.sina.com.cn/s/blog_6e0693f70100tzvz.html

http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/


你可能感兴趣的:(VS2010 安装与使用QT 4.7.4)