Qt环境搭建之vs2005
1. 环境简介
PC Windows XP
Qt 4.7.1
IDE Microsoft Visual Studio 2005
2. 所需安装文件
①. VS2005_DVD.iso
②. qt-sdk-win-opensource-2010.05.exe <包含qt creator 2.0.1和qt 4.7.0库,qt creator是qt的集成开发环境,qt库是用mingw编译的>
③. qt-4.7.1-wince.rar
④. HSBC_1254_SDK.msi
3. 安装
1) 安装 qt-sdk-win-opensource-2010.05.exe ,可选其他路径,这里选的是C:\Qt\qt-sdk-2010.05(下文简称该路径为“安装目录”,请对号入座)。建议安装目录选为:驱动器\qt(驱动器意为C/D/E/F等),否则可能需要修改qt creator的环境变量,bin文件夹的qtenv.bat文件是用来配置qt creator环境变量的,具体位置为:安装目录\bin\qtenv.bat。安装所需空间约为1.7G。
添加环境变量(我的电脑→属性→高级→环境变量):
①新建系统变量:变量名:QTDIR,变量值:安装目录\qt;
②给PATH变量增加路径:安装目录\qt\bin。
③打开qt creator→Tools→Options→Qt4→Qt Versions→Auto-detected→Qt in PATH→下面有一个MinGW directory,设置为:安装目录\mingw。
如果之前装过qt creator,则可能需要修改gdb的3个exe文件的路径,不然调试的时候会提示找不到gdb。
Gdb位置:qt creator→Tools→Options→Debugger→Gdb,修改如下:
执行文件1:gdb-i686-pc-mingw32.exe
位置1:安装目录\pythongdb\gdb-i686-pc-mingw32.exe
执行文件2:gdb-arm-none-symbianelf.exe
位置2:安装目录\pythongdb\gdb-arm-none-symbianelf.exe
执行文件3:gdb-i686-pc-mingw32.exe
位置3:安装目录\pythongdb\gdb-i686-pc-mingw32.exe
注:如果只是在Windows XP上运行,则上面一步就够了,如果想为qt建立wince的开发环境,则还需以下步骤:
2) 安装 Microsoft Visual Studio 2005,安装所需空间约为2G,已安装的可跳过。
3) 安装 HSBC_1254_SDK.msi 。
4) 解压qt-4.7.1-wince.rar 至 C:\Qt\ 目录下,必须是这个目录,最终压缩包中bin文件夹里的qmake.exe的路径应是:C:\Qt\ qt-4.7.1-wince \bin\qmake.exe。解压所需空间约为2.3G。
4. 编译运行
1) 编译X86上运行的qt程序
用Qt Creator打开qt工程文件.pro直接编译即可。
2) 编译wince上运行的qt程序
1. 新建一文本文档,写入下面一行的命令:
C:\Qt\qt-4.7.1-wince\bin\qmake.exe -tp vc
保存,修改文本文件名为qmake.bat,将该bat文件复制到qt工程目录下(使bat文件与.pro文件在同一文件夹下),双击运行bat文件,则会生成. vcproj文件(Visual Studio的项目文件)。
2. 编辑①中生成的. vcproj文件,将STANDARDSDK_500全部替换为HSBC_1254(注意:替换完成后检查HSBC_1254 (MIPSII)语句,HSBC_1254与(MIPSII)必须有空格,这样才能正确识别SDK)。 此外,如果其中有相对路径(有 ..\ 字样的),最好把相对路径替换为绝对路径,这样移动工程到其他地方时不会出错,如:
AdditionalIncludeDirectories=""..\..\..\qt-4.7.1-wince\include\QtCore"…(后面的省略)”
则替换为:
AdditionalIncludeDirectories=""C:\Qt\qt-4.7.1-wince\include\QtCore"…(后面的省略)”
3. 用VS 2005打开这个项目,进行相应的生成,部署工作。
4. 运行程序。编译生成的exe文件不能单独运行,需要相应的动态链接库,所以需要事先将所需的动态库复制到程序所在文件夹。
各版本所需的动态连接库:
平台、配置
动态库
路径
平台:wince
配置:debug
msvcr80d.dll
C:\Program Files\Microsoft Visual Studio 8\VC\ce\Dll\mipsii
QtCored4.dll
QtGuid4.dll
C:\Qt\qt-4.7.1-wince\lib
平台:wince
配置:release
msvcr80.dll
C:\Program Files\Microsoft Visual Studio 8\VC\ce\Dll\mipsii
QtCore4.dll
QtGui4.dll
C:\Qt\qt-4.7.1-wince\lib
平台:X86
配置:debug
mingwm10.dll
libgcc_s_dw2-1.dll
安装目录\mingw\bin
QtCored4.dll
QtGuid4.dll
安装目录\qt\bin
平台:X86
配置:release
mingwm10.dll
libgcc_s_dw2-1.dll
安装目录\mingw\bin
QtCore4.dll
QtGui4.dll
安装目录\qt\bin
5. 联机调试。
首先在Visual Studio 2005上进行设置,工具→选项→设备工具→设备→选择 AMD DB1200: MIPSII_Release 设备→属性→传输→配置→配置 TCP/IP 传输→使用特定 IP 地址→输入终端的IP地址→完成设置。注:终端与PC机应在同一网段。
然后将以下文件复制到终端上,如\NAND FLASH\mipsii目录。
文件位置:C:\Program Files\Common Files\Microsoft Shared\CoreCon\1.0\Target\wce400\mipii
文件:mipii文件夹里的所有文件(共5个)。
最后开始连接。先在终端上运行conmanclient2.exe,再运行cMaccept.exe。然后在vs2005里,工具→连接到设备→选择 AMD DB1200: MIPSII_Release 设备→连接→成功。如果失败,可检查网络是否连通(在电脑上运行命令 “ping 终端IP地址” 来检测)。调试时需要事先将msvcr80d.dll文件拷贝至远程执行文件目录(终端上)。QtCored4.dll和QtGuid4.dll它会自动上传。
附:qt-4.7.1-wince库的编译
1) 解压qt-everywhere-opensource-src-4.7.1.tar.gz至想安装的目录,如c:\Qt\qt-4.7.1-wince,注意此目录最好短一些,并且不要加空格。
2) 在C:\Qt\qt-4.7.1-wince\src\corelib\global目录添加qconfig.h和qconfig.cpp文件,文件内容附后。
3) 进入Visual Studio 2005命令行,开始配置和编译,过程如下
①配置环境变量
PATH C:\Qt\qt-4.7.1-wince\bin\;%PATH%
②进入安装目录
C:
cd C:\Qt\qt-4.7.1-wince
③配置编译选项
configure -platform win32-msvc2005 -xplatform wince50standard-mipsii-msvc2005
④设置 wince sdk 的包含文件、库文件、执行文件的路径
bin\checksdk.exe -sdk "HSBC_1254 (MIPSII)" -script tmp.bat
tmp.bat
④开始编译
nmake
附qconfig.h和qconfig.cpp
/*************qconfig.h*************/
/* Everything */
#ifndef QT_DLL
#define QT_DLL
#endif
/* License information */
#define QT_PRODUCT_LICENSEE "Open Source"
#define QT_PRODUCT_LICENSE "OpenSource"
// Qt Edition
#ifndef QT_EDITION
# define QT_EDITION QT_EDITION_OPENSOURCE
#endif
#if defined(__SYMBIAN32__)
# define QT_BUILD_KEY "Symbian full-config"
#else
# if (!QT_NO_DEBUG)
# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
# define QT_BUILD_KEY "Windows x64 msvc debug full-config"
# else
# define QT_BUILD_KEY "Windows msvc debug full-config"
# endif
# else
# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
# define QT_BUILD_KEY "Windows x64 msvc release full-config"
# else
# define QT_BUILD_KEY "Windows msvc release full-config"
# endif
# endif
#endif
/* Machine byte-order */
#define Q_BIG_ENDIAN 4321
#define Q_LITTLE_ENDIAN 1234
#define Q_BYTE_ORDER Q_LITTLE_ENDIAN
// Compile time features
#define QT_ARCH_WINDOWSCE
#if defined(QT_GRAPHICSSYSTEM_RASTER) && defined(QT_NO_GRAPHICSSYSTEM_RASTER)
# undef QT_GRAPHICSSYSTEM_RASTER
#elif !defined(QT_GRAPHICSSYSTEM_RASTER)
# define QT_GRAPHICSSYSTEM_RASTER
#endif
#if defined(QT_NO_DBUS) && defined(QT_DBUS)
# undef QT_NO_DBUS
#elif !defined(QT_NO_DBUS)
# define QT_NO_DBUS
#endif
#if defined(QT_NO_EXCEPTIONS) && defined(QT_EXCEPTIONS)
# undef QT_NO_EXCEPTIONS
#elif !defined(QT_NO_EXCEPTIONS)
# define QT_NO_EXCEPTIONS
#endif
#if defined(QT_NO_FREETYPE) && defined(QT_FREETYPE)
# undef QT_NO_FREETYPE
#elif !defined(QT_NO_FREETYPE)
# define QT_NO_FREETYPE
#endif
#if defined(QT_NO_IMAGEFORMAT_JPEG) && defined(QT_IMAGEFORMAT_JPEG)
# undef QT_NO_IMAGEFORMAT_JPEG
#elif !defined(QT_NO_IMAGEFORMAT_JPEG)
# define QT_NO_IMAGEFORMAT_JPEG
#endif
#if defined(QT_NO_IMAGEFORMAT_MNG) && defined(QT_IMAGEFORMAT_MNG)
# undef QT_NO_IMAGEFORMAT_MNG
#elif !defined(QT_NO_IMAGEFORMAT_MNG)
# define QT_NO_IMAGEFORMAT_MNG
#endif
#if defined(QT_NO_IMAGEFORMAT_TIFF) && defined(QT_IMAGEFORMAT_TIFF)
# undef QT_NO_IMAGEFORMAT_TIFF
#elif !defined(QT_NO_IMAGEFORMAT_TIFF)
# define QT_NO_IMAGEFORMAT_TIFF
#endif
#if defined(QT_NO_OPENGL) && defined(QT_OPENGL)
# undef QT_NO_OPENGL
#elif !defined(QT_NO_OPENGL)
# define QT_NO_OPENGL
#endif
#if defined(QT_NO_OPENSSL) && defined(QT_OPENSSL)
# undef QT_NO_OPENSSL
#elif !defined(QT_NO_OPENSSL)
# define QT_NO_OPENSSL
#endif
#if defined(QT_NO_OPENVG) && defined(QT_OPENVG)
# undef QT_NO_OPENVG
#elif !defined(QT_NO_OPENVG)
# define QT_NO_OPENVG
#endif
#if defined(QT_NO_STL) && defined(QT_STL)
# undef QT_NO_STL
#elif !defined(QT_NO_STL)
# define QT_NO_STL
#endif
#if defined(QT_NO_STYLE_CDE) && defined(QT_STYLE_CDE)
# undef QT_NO_STYLE_CDE
#elif !defined(QT_NO_STYLE_CDE)
# define QT_NO_STYLE_CDE
#endif
#if defined(QT_NO_STYLE_CLEANLOOKS) && defined(QT_STYLE_CLEANLOOKS)
# undef QT_NO_STYLE_CLEANLOOKS
#elif !defined(QT_NO_STYLE_CLEANLOOKS)
# define QT_NO_STYLE_CLEANLOOKS
#endif
#if defined(QT_NO_STYLE_GTK) && defined(QT_STYLE_GTK)
# undef QT_NO_STYLE_GTK
#elif !defined(QT_NO_STYLE_GTK)
# define QT_NO_STYLE_GTK
#endif
#if defined(QT_NO_STYLE_MOTIF) && defined(QT_STYLE_MOTIF)
# undef QT_NO_STYLE_MOTIF
#elif !defined(QT_NO_STYLE_MOTIF)
# define QT_NO_STYLE_MOTIF
#endif
#if defined(QT_NO_STYLE_PLASTIQUE) && defined(QT_STYLE_PLASTIQUE)
# undef QT_NO_STYLE_PLASTIQUE
#elif !defined(QT_NO_STYLE_PLASTIQUE)
# define QT_NO_STYLE_PLASTIQUE
#endif
#if defined(QT_NO_STYLE_S60) && defined(QT_STYLE_S60)
# undef QT_NO_STYLE_S60
#elif !defined(QT_NO_STYLE_S60)
# define QT_NO_STYLE_S60
#endif
#if defined(QT_NO_STYLE_WINDOWSVISTA) && defined(QT_STYLE_WINDOWSVISTA)
# undef QT_NO_STYLE_WINDOWSVISTA
#elif !defined(QT_NO_STYLE_WINDOWSVISTA)
# define QT_NO_STYLE_WINDOWSVISTA
#endif
#if defined(QT_NO_STYLE_WINDOWSXP) && defined(QT_STYLE_WINDOWSXP)
# undef QT_NO_STYLE_WINDOWSXP
#elif !defined(QT_NO_STYLE_WINDOWSXP)
# define QT_NO_STYLE_WINDOWSXP
#endif
#if defined(QT_NO_WEBKIT) && defined(QT_WEBKIT)
# undef QT_NO_WEBKIT
#elif !defined(QT_NO_WEBKIT)
# define QT_NO_WEBKIT
#endif
#if defined(QT_NO_XMLPATTERNS) && defined(QT_XMLPATTERNS)
# undef QT_NO_XMLPATTERNS
#elif !defined(QT_NO_XMLPATTERNS)
# define QT_NO_XMLPATTERNS
#endif
/*************qconfig.cpp*************/
/* Licensed */
static const char qt_configure_licensee_str [512 + 12] = "qt_lcnsuser=Open Source";
static const char qt_configure_licensed_products_str [512 + 12] = "qt_lcnsprod=OpenSource";
/* Build date */
static const char qt_configure_installation [11 + 12] = "qt_instdate=2011-09-03";
static const char qt_configure_prefix_path_str [512 + 12] = "qt_prfxpath=C:\\qt\\qt-4.7.1-wince";
static const char qt_configure_documentation_path_str [512 + 12] = "qt_docspath=C:\\qt\\qt-4.7.1-wince\\doc";
static const char qt_configure_headers_path_str [512 + 12] = "qt_hdrspath=C:\\qt\\qt-4.7.1-wince\\include";
static const char qt_configure_libraries_path_str [512 + 12] = "qt_libspath=C:\\qt\\qt-4.7.1-wince\\lib";
static const char qt_configure_binaries_path_str [512 + 12] = "qt_binspath=C:\\qt\\qt-4.7.1-wince\\bin";
static const char qt_configure_plugins_path_str [512 + 12] = "qt_plugpath=C:\\qt\\qt-4.7.1-wince\\plugins";
static const char qt_configure_imports_path_str [512 + 12] = "qt_impspath=C:\\qt\\qt-4.7.1-wince\\imports";
static const char qt_configure_data_path_str [512 + 12] = "qt_datapath=C:\\qt\\qt-4.7.1-wince";
static const char qt_configure_translations_path_str [512 + 12] = "qt_trnspath=C:\\qt\\qt-4.7.1-wince\\translations";
static const char qt_configure_examples_path_str [512 + 12] = "qt_xmplpath=C:\\qt\\qt-4.7.1-wince\\example";
static const char qt_configure_demos_path_str [512 + 12] = "qt_demopath=C:\\qt\\qt-4.7.1-wince\\demos";
/* strlen( "qt_lcnsxxxx") == 12 */
#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;
#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;
#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;
#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;
#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;
#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;
#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;
#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;
#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;
#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;
#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;
#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;
#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;
本文档为【Qt环境搭建之vs2005】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。