【VC++开源代码栏目提醒】:本文主要为网学会员提供“解析Visual Studio 2005中QT配置使用 - 软件工程”,希望对需要解析Visual Studio 2005中QT配置使用 - 软件工程网友有所帮助,学习一下!
解析 Visual Studio 2005 中 QT 配置使用2011-06-09 15:47 佚名 互联网 我要评论0 字号:T T本文讲述的是 Visual Studio 2005 中 QT 配置使用(VS2005QTIntegrationPlugin)。
对于数据库就不多做解释了。
AD:Qt 配置 VS2005 安装环境(VS2005QTIntegrationPlugin)1.正常安装 Visual Studio 2005只要安装了 C即可.。
注意:不是 Express 版本.2.下载 Qt 源
代码Qt 4.3.2 Windows OpenSource 版下载:http://www.qtcn.org/download/qt-win-opensource-src-4.3.2.zipftp://ftp.trolltech.com/qt/source/qt-win-opensource-src-4.3.2.zip3.解压
代码目录结构建议: 1. C:Qt4.3 Visual Studio Tools 运行命令行.需要注意的是,这里面必须是使用 Visual Studio Command Prompt 2005,不能使用 CMD 的 Dos 窗口下面是检查运行环境是否正确的方法就是运行 nmake 命令 1. D:Qt4.3.2-msvc2005 nmake / 2. Microsoft R Program Maintenance Utility Version 8.00.50727.42 3. Copyright C Microsoft Corporation. All rights reserved. 4. Usage: NMAKE commandfile 5. NMAKE options /f makefile /x stderrfile macrodefs targets 6. Options: 7. ....这个版本不需要打 acs-4.3.x-patch3.zip 就可以编译了.配置编译的命令行: D:Qt4.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 可以加上-platformwin32-msvc2005表示 VS2005 的,6.0 使用 win32-msvc 2003 使用 win32-msvc.net 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 之前,把以下这几个文件给删除就可以了:…qtsrcscripttmpmocdebug_sharedmocinclude.tmp…qtsrcscripttmpmocrelease_sharedmocinclude.tmp…qtsrc3rdpartywebkitWebCoretmpmocdebug_sharedmocinclude.tmp…qtsrc3rdpartywebkitWebCoretmpmocrelease_sharedmocinclude.tmp如果你觉得不放心,那就在 qtsrc 目录下搜索一下,看到是在mocdebug_shared 或者是mocrelease_shared 目录的 mocinclude.tmp 文件,就直接删除好了。
这样再运行 nmake等上它几个小时。
5.配置环境变量好像主要为了在命令行的时候使用.在我的电脑上单击右键进入属性然后打开环境变量对话框.在 PATH 环境变量中添加:D:Qt4.3.2-msvc2005bin.添加新的环境变量名字为QMAKESPEC值为win32-msvc2005.6.安装 Visual Studio 的插件在网上下载 Qt Visual Studio Integration v1.2.2 for.VS.2003.2005.exe安装之.安装的时候用户名任意注册码为下列值之一: 1. FGJ7UGX-WQPWJ6X-F4M-UG6ZQC-2G8N2G-6AYP3G-864F 2. FGJ58F-HQGNCCM-F4M-BVY8ELX-8KG9WT-NU5JAQ-6C21 3. FGBBY3M-WYYUFN9-F4M-GWEVVS9-WTKP39X-UKJUUDM-EE0D 4. FGM9UXX-PJ8CRVX-F4M-UQDJFQ9-PXHXTQ-BZF46Y9-694B7.配置 Visual Studio 2005.Tools - Options - Qt - Builds 添加我们刚才编译的 Qt
代码名字为Qt 4.3.2 路径为D:Qt4.3.2-msvc2005.8.如果安装 Visual Assist 的话需要配置一下才有
代码提示功能. 1. VAssistX - Visual Assist X Options ... - Projects在Platform里面把Win32改为Custom在Stable include files末尾添加D:Qt4.3.2-msvc2005include.9.写一个小的测试用例吧.启动一个新的工程.选择Qt projects - Qt Application类型输入工程名字单击 OK.一路 Next最后 Finish.双击工程文件里面的test.ui马上出现了所见及所得的窗体编辑器在上面添加一个按钮.双击按钮产生相应的消息响应函数.添加头文件:include在函数 void Test::on_pushButton_clicked体内添加如下
代码: 1. QMessageBox boxthis 2. box.setTextHaha hit me. 3. box.exec编译运行工程效果如下:【编辑推荐】下面是我从网上搜索到的 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 distributeMOC 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 compilewith 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-plugin -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-尖括号里包含上面的样式。
上一篇:
网络GIS开发技术手册
下一篇:
应用数学学报编辑部联系方式