本文将使用简单的几个步骤说明在VC 2005下如何编译安装并开发Qt4.6应用程序,其实大部分方法和Qt4.6.0是一样的,不过Qt4.6.0集成了Qt Creater,目录的形式有点改变了,现在我就把我的安装方法分享给大家(首先保证你的Qt安装目录所在的磁盘有5G空间,因为我的是完全编译,除了例子,加上例子应该是10G多):

一、下载及安装

1. 下载,直接找官网下载就可以了,我的是qt-win-opensource-4.6.0-beta1-mingw.exe

2. 设置环境变量:

我的电脑>属性>高级>环境变量>用户变量里面设置几个变量(我把QT装在了D盘中,且使用了它默认的目录):

PATH中增加C:/Qt/4.6.0-beta1/bin(注意:这个与Qt4.4.3就不一样了,多了一级目录);

创建QMAKESPEC值为 win32-msvc2005,这个值还是根据你要生成的Vs版本,6.0 使用win32-msvc, 2003 使用win32-msvc.net, 2005就是 win32-msvc2005 ;

创建QTDIR值为 C:/Qt/4.6.0-beta1

最后为了使的你刚才修改的环境变量生效,重启cmd,可以通过C:/>qmake -v来看你使用的QT版本,应该显示的是Qt4.6.0.

3. 从VC 2005的安装路径找到vsvars32.bat(以你自己的安装目录为准,我的是D:/Program Files/Microsoft Visual Studio 8/Common7/Tools):

运行cmd

C:/> D:

C:/>cd D:/Program Files/Microsoft Visual Studio 8/Common7/Tools
D:/>Program Files/Microsoft Visual Studio 8/Common7/Tools> vsvars32.bat
D:/> cd D:/Qt/2009.03/qt
D:/Qt/2009.03/qt> configure -debug-and-release -platform win32-msvc2005 -opensource -stl -fast -vcproj

configure -debug-and-release 参数的意义是告诉QT同时编译为Debug和Release两个版本的库,不指定参数则编译为Debug版本的动态链接库如果安装了多个版本的VS可以加上-platform win32-msvc2005(表示VS2005的),6.0 使用win32-msvc, 2003 使用win32-msvc.net, 2008就是win32-msvc2008。configure大约需要几分钟,-nomake examples -nomake demos就是不编译例子,值钱我介绍的把这两个目录移走的方法不太好。但是按我的这个configure变异的话,会有问题的,编译不通过,因为我的这是完全编译,我编译了3次才过的,每次到编译webkit的时候就出错,据说这是Qt4.5的bug,但是我从网上找到了解决办法,就是在configure之后先不要nmake,删除D:/Qt/2009.03/qt/src/3rdparty/webkit/WebCore/tmp/moc/debug_shared/mocinclude.tmp文件和D:/Qt/2009.03/qt/src/3rdparty/webkit/WebCore/tmp/moc/release_shared/mocinclude.tmp文件,然后再namke吧,一定成功得,呵呵~

下面是我从网上搜索到的configure的具体参数,供大家编译参考:

个人认为只需要加个 -fast参数就ok了。其他参数视自己情况而定,比如你不需要qt3支持可以添加-no-qt3support,或者不需要webkit插件 -no-webkit
配置参数选项:
 前面是*号的表示默认参数. +号表示该功能要求被评估,评估成功后才能被接受.
    -release ........... 调试关闭.没有调试库,自己的项目只能发布,不能调试(没有调试库的缘故),如果你硬要编译debug版本的话,会提示找不到xxxxxd.dll 
 *  -debug ............. 只有调试库,没有释放库,也就是说以后自己的项目只能调试,如果你硬要编译debug版本的话,会提示找不到xxxxx.dll
 +  -debug-and-release . 编译后包含两种库。最好编译两种库
    -opensource ........ 编译开源版.
    -commercial ........ 编译商业版.  这两个参数一般不需指定,configure开始需要你选择版本。
    -developer-build ... 编译开发者选项。
 *  -shared ............动态编译.
    -static ............ 静态链接库.貌似有插件不能用静态编译。
 *  -no-fast ........... configure生成所有项目makefiles文件,并编译
    -fast .............. 只生成库目录及子目录下的项目的makefiles文件. 
    -no-exceptions ..... 关闭异常支持
 *  -exceptions ........ 开启异常支持.
    -no-accessibility .. 关闭对windows active控件支持.
 *  -accessibility .....对windows active控件支持.
    -no-stl ............ 无c++标准库支持
 *  -stl ............... 有标准库支持
尖括号在blogger出问题了。。。。。
    -no-sql- ... Disable SQL entirely, by default none are turned on.
    -qt-sql- ... Enable a SQL in the Qt Library.
    -plugin-sql-  Enable SQL as a plugin to be linked to at runtime.
                         Available values for :
                           mysql
                           psql
                           oci
                           odbc
                           tds
                           db2
 +                         sqlite
                           sqlite2
                           ibase
                         (drivers marked with a '+' have been detected as available on this system)
    -system-sqlite ..... Use sqlite from the operating system.
    -no-qt3support ..... 不提供对qt3函数支持
    -no-opengl ......... 不提供OpenGL函数支持
    -platform ... The operating system and compiler you are building on.
                         (default %QMAKESPEC%)
    -xplatform .. The operating system and compiler you are cross compiling to.
                         See the README file for a list of supported operating systems and compilers.
    -qtnamespace Wraps all Qt library code in 'namespace name {...}
    -D ........ Add an explicit define to the preprocessor.
    -I ... Add an explicit include path.
    -L ... Add an explicit library path.
    -l ... Add an explicit library name, residing in a librarypath.
    -graphicssystem Specify which graphicssystem should be used.
                          Available values for :
 *                         raster - Software rasterizer
                           opengl - Using OpenGL accelleration, experimental!
    -help, -h, -? ...... Display this information.
第三方库
    -qt-zlib ........... 使用zlib绑定到qt.
 +  -system-zlib ....... 使用操作系统的zlib
                         见 http://www.gzip.org/zlib
    -no-gif ............ 不编译gif文件读取支持插件
 +  -qt-gif ............ 编译gif文件读取支持插件
                         参见 src/plugins/imageformats/gif/qgifhandler.h
    -no-libpng ......... 不编译PNG支持插件.
    -qt-libpng ......... 编译PNG支持插件.
 +  -system-libpng ..... 使用系统libpng库
                         见 http://www.libpng.org/pub/png
    -no-libmng ......... 不编译MNG支持插件.
    -qt-libmng ......... 编译MNG支持插件.
 +  -system-libmng ..... 使用系统的mng库
                         参见 http://www.libmng.com
    -no-libtiff ........ 不编译tiff支持插件.
    -qt-libtiff ........ 编译tiff支持插件.
 +  -system-libtiff .... 使用系统的libtiff库
                         见 http://www.libtiff.org
    -no-libjpeg ........ 不编译jpeg支持插件库
    -qt-libjpeg ........ 编译jpeg支持插件库
 +  -system-libjpeg .... 使用系统的jpeg支持库
                        见 http://www.ijg.org
以下参数仅对qt for windows有效
    -no-dsp ............ 不生成 VC++ .dsp 文档.
 *  -dsp ...............生成 VC++ .dsp文档, 需要有平台标识符"win32-msvc".注意 qt4开始就不支持vc6.0了所以这两个参数无效。
    -no-vcproj ......... 不生成 VC++ .vcproj 文档
 *  -vcproj ............ 生成 VC++ .vcproj 文档, 需要平台标识符"win32-msvc.net".也就是vs2003以上的编译环境
    -no-incredibuild-xge Do not add IncrediBuild XGE distribution commands to custom build steps.
 +  -incredibuild-xge .. Add IncrediBuild XGE distribution commands to custom build steps. This will distribute MOC and UIC steps, and other custom buildsteps which are added to the INCREDIBUILD_XGE variable.
                         (The IncrediBuild distribution commands are only added to Visual Studio projects)
    -no-plugin-manifests  插件不嵌入manifests.
 *  -plugin-manifests .. 插件嵌入manifests.
    -no-qmake .......... 不编译qmake
 *  -qmake ............. 编译 qmake.   不建议 不编译qmake
    -dont-process ...... 不生成makefiles和project文档. 比 -no-fast 参数优先级更高
 *  -process ........... 生成makefiles和project文档.
    -no-rtti ........... 不编译运行时类型信息。
 *  -rtti .............. 编译运行时类型信息。
//下面是对指令的支持,不解释了
    -no-mmx ............ Do not compile with use of MMX instructions
 +  -mmx ............... Compile with use of MMX instructions
    -no-3dnow .......... Do not compile
with use of 3DNOW instructions
 +  -3dnow ............. Compile with use of 3DNOW instructions
    -no-sse ............ Do not compile with use of SSE instructions
 +  -sse ............... Compile with use of SSE instructions
    -no-sse2 ........... Do not compile with use of SSE2 instructions
 +  -sse2 .............. Compile with use of SSE2 instructions
 +  -direct3d ..........  将Direct3D支持编译进来。检测不到direct3d sdk 就不支持
    -no-openssl ........ Do not compile in OpenSSL support
 +  -openssl ........... Compile in run-time OpenSSL support
    -openssl-linked .... Compile in linked OpenSSL support
    -no-dbus ........... Do not compile in D-Bus support
 +  -dbus .............. Compile in D-Bus support and load libdbus-1 dynamically
    -dbus-linked ....... Compile in D-Bus support and link to libdbus-1
    -no-phonon ......... 不将 Phonon 模块编译进来
 +  -phonon ............ 将 Phonon 模块编译进来  (若使用的规范的c++编译器则会自动编译Phonon模块)
    -no-phonon-backend . Do not compile the platform-specific Phonon backend-plu
gin
 *  -phonon-backend .... Compile in the platform-specific Phonon backend-plugin
    -no-webkit ......... 不将webkit模块编译进来,编译webkit非常耗时间。
 +  -webkit ............ 将webkit模块编译进来 (若使用的规范的c++编译器则会自动编译WebKit模块)
    -no-scripttools .... Do not build the QtScriptTools module.
 *  -scripttools ....... Build the QtScriptTools module.
    -arch ....... 外观样式.
                        有以下几种 :
 *                         windows
                           windowsce
                           boundschecker
                           generic
    -no-style-尖括号里包含上面的样式。

4.完成了configure后就可以接着运行:

D:/Qt/2009.03/qt> nmake

漫长的等待吧,该干什么干什么去吧,我大概花了6个半小时,呵呵,我是完全编译的,中间会出现一些warning,无关紧要的,呵呵~

5.最后编译完成后运行nmake confclean命令清除编译过程中的临时文件,以节省空间,大概是4500M左右;

6. 将Qt路径添加到VC编译环境中,工具->选项->项目和解决方案->VC++目录,在包含库文件一栏添加:

QtGui4.lib;

QtCore4.lib;

另外补充一点如果你用Qt Creater开发的话,工程的目录中不能有汉字,否则会编译出错的,还有就是有个集成Qt到VS的插件,那个插件目前只支持英文的VS2005,中文的会在启动VS2005时出错的!

http://blog.csdn.net/masonwu21/article/details/4770274

VS2005下如何安装配置编译Qt4.6的更多相关文章

  1. [转]Caffe在Linux下的安装,编译,实验

    Caffe在Linux下的安装,编译,实验  原文地址:http://www.cnblogs.com/evansyang/p/6150118.html 第一部分:Caffe 简介 caffe是有伯克利 ...

  2. Linux下PHP安装配置MongoDB数据库连接扩展

    Web服务器: IP地址:192.168.21.127 PHP安装路径:/usr/local/php 实现目的: 安装PHP的MongoDB数据库扩展,通过PHP程序连接MongoDB数据库 具体操作 ...

  3. centOS下yum安装配置samba

     centOS下yum安装配置samba 2010-03-29 15:46:00 标签:samba yum centOS 安装 休闲 注意:本文的原则是只将文件共享应用于内网服务器,并让将要被共享的目 ...

  4. Windows 下如何安装配置Snort视频教程

    Windows 下如何安装配置Snort视频教程: 第一步: http://www.tudou.com/programs/view/UUbIQCng360/ 第二部: http://www.tudou ...

  5. windows下如何安装配置mysql-5.7-m14-winx64(zip格式的安装)

    win7 64位下如何安装配置mysql-5.7.4-m14-winx64 1.   mysql-5.7.4-m14-winx64.zip下载 官方网站下载地址:http://dev.mysql.co ...

  6. win7 64位下如何安装配置mysql-5.7.4-m14-winx64

    win7 64位下如何安装配置mysql-5.7.4-m14-winx641. mysql-5.7.4-m14-winx64.zip下载 官方网站下载地址:http://dev.mysql.com/g ...

  7. CentOS 6.3下NFS安装配置

    CentOS 6.3下NFS安装配置 一.环境介绍   NFS服务器:CentOS6.3 192.168.8.20 NFS客户端:CentOS6.5 192.168.8.39 二.服务器端安装配置   ...

  8. VMware Linux 下 Nginx 安装配置 - nginx.conf 配置 [负载两个 Tomcat] (三)

    首先启动Nginx 1. 相关浏览 两个 Tomcat 配置:  VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二) Nginx 安装配置启动: VMware Linu ...

  9. VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二)

    准备工作 相关浏览: VMware Linux 下 Nginx 安装配置 (一) 1. 选在 /usr/local/ 下创建 softs 文件夹,通过 ftp 命令 把 apache-tomcat-7 ...

随机推荐

  1. Remove Duplicates from Sorted Array [Python]

    Given a sorted array, remove the duplicates in place such that each element appear only once and ret ...

  2. [Yarn] Use Yarn to Create an Alternative Import Name of an Installed Library

    In this lesson we'll show how to use yarn to alias the names of same npm libraries but install diffe ...

  3. swift学习第十四天:属性监听器

    监听属性的改变 在OC中我们可以重写set方法来监听属性的改变 Swift中可以通过属性观察者来监听和响应属性值的变化 通常是监听存储属性和类属性的改变.(对于计算属性,我们不需要定义属性观察者,因为 ...

  4. vmnet1 and vmnet8

    在使用VMware Workstation创建虚拟机时.创建的虚拟机中能够包含网卡.你能够依据须要选择使用何种虚拟网卡.从而表明想要连接到那个虚拟交换机.在VMware Workstation中,默认 ...

  5. jquery获取选中select的文本,值等

    jquery获取select选择的文本与值获取select :获取select 选中的 text :    $("#ddlregtype").find("option:s ...

  6. HTTPS和SSL/TLS协议

    要说清楚 HTTPS 协议的实现原理,至少需要如下几个背景知识.1. 大致了解几个基本术语(HTTPS.SSL.TLS)的含义2. 大致了解 HTTP 和 TCP 的关系(尤其是“短连接”VS“长连接 ...

  7. 【前端统计图】hcharts实现堆叠柱形图(与后台数据交互)

    原型图类似如下: 图片.png <!DOCTYPE > <html> <head> <meta charset="utf-8">&l ...

  8. spring boot中servlet启动原理

    启动过程及原理 1 spring boot 应用启动运行run方法 StopWatch stopWatch = new StopWatch(); stopWatch.start(); Configur ...

  9. 通过rinetd实现port转发来訪问内网的服务

    一.   问题描写叙述 通过外网来訪问内网的服务 二.   环境要求 须要有一台能够外网訪问的机器做port映射.通过数据包转发来实现外部訪问阿里云的内网服务 三.   操作方法 做port映射的方案 ...

  10. Hudson版本控制 (备注)

    http://www.ttlsa.com/tools/install-hudson-on-linux/