解析Visual Studio 2005中QT配置使用
更新时间:2023-05-24 07:18:01 阅读量: 实用文档 文档下载
VS2005配置QT环境详解,已经试验过多次总结出来的。
解析Visual Studio 2005中QT配置使用
2011-06-09 15:47 佚名 互联网 我要评论(0) 字号:T | T
本文讲述的是Visual Studio 2005中QT配置使用(VS2005+QT+IntegrationPlugin)。对于数据库就不多做解释了。 AD:
Qt配置VS2005安装环境(VS2005+QT+IntegrationPlugin)
1.正常安装Visual Studio 2005,只要安装了C++即可.。注意:不是Express版本.
2.下载Qt源代码
Qt 4.3.2 Windows OpenSource版下载:
/download/qt-win-opensource-src-4.3.2.zip
ftp:///qt/source/qt-win-opensource-src-4.3.2.zip
3.解压代码
目录结构建议:
1.
2.
3.
C:\Qt\4.3\ (<-- 打算用其他编译环境) C:\Qt\4.3-msvc2005\ (<-- 如过你打算用Visual Studio 2005) 配置环境变量: Path:增加以下路径 C:\Qt\4.8.0\bin 新建QTDIR=C:\Qt\4.8.0 新建include=C:\Program Files\Microsoft Visual Studio 8\VC\include 新建lib= C:\Program Files\Microsoft Visual Studio 8\VC\lib
注意:目录中间不要有空格,据说后面编译会出问题.
4.编译源代码
通过"开始"菜单 -> "Microsoft Visual Studio 2005" -> "Visual Studio Tools", 运行命令行.
需要注意的是,这里面必须是使用Visual Studio Command Prompt (2005),不能使用CMD的Dos窗口 下面是检查运行环境是否正确的方法,就是运行nmake命令
1.
2.
3.
4.
5.
6. D:\Qt\4.3.2-msvc2005> nmake /? Microsoft (R) Program Maintenance Utility Version 8.00.50727.42 Copyright (C) Microsoft Corporation. All rights reserved. Usage: NMAKE @commandfile NMAKE [options] [/f makefile] [/x stderrfile] [macrodefs] [targets] Options:
VS2005配置QT环境详解,已经试验过多次总结出来的。
7. ....
这个版本不需要打acs-4.3.x-patch3.zip就可以编译了.
配置编译的命令行:
D:\Qt\4.3.2-msvc2005> configure -debug-and-release -static -platform win32-msvc2005 或configure -no-stl -no-dsp -vcproj
(configure -debug-and-release 参数的意义是告诉QT同时编译为Debug和Release两个版本的库,不指定参数则编译为Debug版本的动态链接库如果安装了多个版本的VS可以加上-platform
win32-msvc2005(表示VS2005的),6.0 使用win32-msvc, 2003 使用, 2008就是 win32-msvc2008,具体参数说明见最后一页。)
编译过程中,会问一个问题,是否接受GPL协议,选 'y'.这个过程会花掉大约10~20分钟。如果执行的时间很短,并最后出现“Perl not found in environment - cannot run syncqt.”表示没能configure成功。解决办法:删除QT安装目录bin下的syncqt和syncqt.bat文件。
最后简单的敲入nmake即可,这里,我花掉了两个多小时。如果nmake完之后会出现以下情况
时,产生fatal error的原因是Qt SDK 安装包的一个Bug, 安装包将一些多余的.tmp文件连同Qt的源文件一起拷贝到了安装目录中,而这些tmp文件是应该由nmake在编译时才创建的,所以它导致了以上的编译错误。 (错误信息可能和上面的不完全一样,不同的.tmp文件会导致不一样的错误信息。
解决办法:
在执行nmake之前,把以下这几个文件给删除就可以了:
\qt\src\script\tmp\moc\debug_shared\mocinclude.tmp
\qt\src\script\tmp\moc\release_shared\mocinclude.tmp
\qt\src\3rdparty\webkit\WebCore\tmp\moc\debug_shared\mocinclude.tmp
\qt\src\3rdparty\webkit\WebCore\tmp\moc\release_shared\mocinclude.tmp
如果你觉得不放心,那就在qt\src目录下搜索一下,看到是在*\moc\debug_shared或者是*\moc\release_shared目录的mocinclude.tmp文件,就直接删除好了。这样再运行nmake,等上它几个小时。
VS2005配置QT环境详解,已经试验过多次总结出来的。
5.配置环境变量
好像主要为了在命令行的时候使用.
在"我的电脑"上单击右键,进入"属性",然后打开"环境变量"对话框.
在PATH环境变量中添加:"D:\Qt\4.3.2-msvc2005\bin".
添加新的环境变量,名字为"QMAKESPEC",值为"win32-msvc2005".
6.安装Visual Studio的插件
在网上下载Qt Visual Studio Integration v1.2.2 for.VS.2003.2005.exe,安装之.
安装的时候,用户名任意,注册码为下列值之一:
1.
2.
3.
4. FGJ7UGX-WQPWJ6X-F4M-UG6ZQC-2G8N2G-6AYP3G-864F FGJ58F-HQGNCCM-F4M-BVY8ELX-8KG9WT-NU5JAQ-6C21 FGBBY3M-WYYUFN9-F4M-GWEVVS9-WTKP39X-UKJUUDM-EE0D FGM9UXX-PJ8CRVX-F4M-UQDJFQ9-PXHXTQ-BZF46Y9-694B
7.配置Visual Studio 2005.
"Tools" -> "Options" -> "Qt" -> "Builds", 添加我们刚才编译的Qt代码,名字为"Qt 4.3.2", 路径为
"D:\Qt\4.3.2-msvc2005".
8.如果安装Visual Assist的话,需要配置一下,才有代码提示功能.
1. "VAssistX" -> "Visual Assist X Options ..." -> "Projects"
在"Platform"里面把"Win32"改为"Custom",
在"Stable include files"末尾添加"D:\Qt\4.3.2-msvc2005\include".
9.写一个小的测试用例吧.
VS2005配置QT环境详解,已经试验过多次总结出来的。
启动一个新的工程.
选择"Qt projects" -> "Qt Application"类型,输入工程名字,单击
OK.
一路Next,最后
Finish.
双击工程文件里面的"test.ui",马上出现了所见及所得的窗体编辑器,在上面添加一个按钮.
VS2005配置QT环境详解,已经试验过多次总结出来的。
双击按钮,产生相应的消息响应函数.
添加头文件:
#include <QMessageBox>
在函数void Test::on_pushButton_clicked()体内添加如下代码:
1.
2.
3. QMessageBox box(this); box.setText("Haha, hit me."); box.exec();
编译运行工程,效果如下:
VS2005配置QT环境详解,已经试验过多次总结出来的。
【编辑推荐】
VS2005配置QT环境详解,已经试验过多次总结出来的。
下面是我从网上搜索到的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.
VS2005配置QT环境详解,已经试验过多次总结出来的。
-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
见 /zlib
-no-gif ............ 不编译gif文件读取支持插件
+ -qt-gif ............ 编译gif文件读取支持插件
参见 src/plugins/imageformats/gif/qgifhandler.h
-no-libpng ......... 不编译PNG支持插件.
-qt-libpng ......... 编译PNG支持插件.
+ -system-libpng ..... 使用系统libpng库
见 /pub/png
-no-libmng ......... 不编译MNG支持插件.
-qt-libmng ......... 编译MNG支持插件.
+ -system-libmng ..... 使用系统的mng库
参见
-no-libtiff ........ 不编译tiff支持插件.
-qt-libtiff ........ 编译tiff支持插件.
+ -system-libtiff .... 使用系统的libtiff库
见
-no-libjpeg ........ 不编译jpeg支持插件库
-qt-libjpeg ........ 编译jpeg支持插件库
+ -system-libjpeg .... 使用系统的jpeg支持库
见
以下参数仅对qt for windows有效
-no-dsp ............ 不生成 VC++ .dsp 文档.
* -dsp ...............生成 VC++ .dsp文档, 需要有平台标识符"win32-msvc".注意 qt4开始就不支持vc6.0了所以这两个参数无效。
-no-vcproj ......... 不生成 VC++ .vcproj 文档
* -vcproj ............ 生成 VC++ .vcproj 文档, 需要平台标识符"".也就是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
VS2005配置QT环境详解,已经试验过多次总结出来的。
+ -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-尖括号里包含上面的样式。
正在阅读:
解析Visual Studio 2005中QT配置使用05-24
论文结构及写作要求01-27
小学生日记评语大全02-24
工业设计-石膏模型制作实验报告08-31
2020年江苏高考历史模拟试卷以及答案03-03
哥达纲领批判读书报告05-19
各功能室使用管理制度12-18
幼儿园小班体育活动动作目标及指导要点512139910-08
小学生生活优秀作文500字06-15
中国文化概论复习笔记02-26
- 1Visual Studio问题集锦by低调年华,未完待续
- 2QT控件使用详解
- 3Camtasia Studio 使用教程
- 4abaqus 关联问题:Abaqus 6.14-1+ Microsoft Visual Studio 2012+ Intel Parallel Studio XE
- 5zend studio详细使用教程
- 6QT控件使用详解
- 7abaqus 关联问题:Abaqus 6.14-1 + Microsoft Visual Studio 201
- 8abaqus 关联问题:Abaqus 6.14-1 + Microsoft Visual Studio 201
- 9Materials Studio 5 安装及使用教学 - 图文
- 10Material Studio材料计算的工作站配置方案
- 教学能力大赛决赛获奖-教学实施报告-(完整图文版)
- 互联网+数据中心行业分析报告
- 2017上海杨浦区高三一模数学试题及答案
- 招商部差旅接待管理制度(4-25)
- 学生游玩安全注意事项
- 学生信息管理系统(文档模板供参考)
- 叉车门架有限元分析及系统设计
- 2014帮助残疾人志愿者服务情况记录
- 叶绿体中色素的提取和分离实验
- 中国食物成分表2020年最新权威完整改进版
- 推动国土资源领域生态文明建设
- 给水管道冲洗和消毒记录
- 计算机软件专业自我评价
- 高中数学必修1-5知识点归纳
- 2018-2022年中国第五代移动通信技术(5G)产业深度分析及发展前景研究报告发展趋势(目录)
- 生产车间巡查制度
- 2018版中国光热发电行业深度研究报告目录
- (通用)2019年中考数学总复习 第一章 第四节 数的开方与二次根式课件
- 2017_2018学年高中语文第二单元第4课说数课件粤教版
- 上市新药Lumateperone(卢美哌隆)合成检索总结报告
- 解析
- 配置
- 使用
- Visual
- Studio
- 2005
- 机械设计 第10章 机械传动系统及其传动比
- 有关雅思写作开头的十个高分模板-智课教育出国考试
- 环境分析化学 ZJ (1)
- 没有Microsoft sql Management studio 解决办法
- 英语广告中双关语的运用技巧及翻译
- 2011年秋季学校教学工作总结
- 前进区一年级下册语文期末测试卷(二)C卷
- 复方聚乙二醇电解质散
- 花山水库加固工程++汉江施工组织设计
- 新概念英语青少版B教案详解版
- 2016-2022年中国热敏复印设备行业评估及发展前景报告
- 英语作文思思路点拨
- 浅论新课程理念下如何提高中学数学课堂教学质量
- 德国双元制职业教育的特点及对我国职业教育的启示
- 电动车制造厂融资商业计划书
- 安徽泗县中学2014届初三下数学第一次月考试卷及答案
- 超棒超快的数学心算方法)_
- 医药商标应当怎么注册和商标起名
- ADS1147EVM-PDK;中文规格书,Datasheet资料
- 关于会计专业毕业生自荐信七篇