原创 Qt 4.2.2(OpenSource) build on WinXP with MS VC 200

2008-4-30 21:21 3371 3 3 分类: MCU/ 嵌入式

Qt 4.2.2(OpenSource) build on WinXP with MS Visual C++ 2005 Express Edition

说明
本方法基于Qt 4.2.2 GPL on Windows代码修改,Trolltech提供的原版本只支持mingw编译器,通过qtwin项目提供的补丁,可以支持borland和msvc, ms vs .net, ms vc 2005 ee等编译器,但请不要向Trolltech询问有关这几个编译器的支持问题,如有问题,请和qtwin项目组联系。

下载
ftp://ftp.trolltech.com/qt/source/qt-win-opensource-src-4.2.2.zip
http://www.qtopia.org.cn/ftp/mirror/ftp.trolltech.com/qt/source/qt-win-opensource-src-4.2.2.zip
ftp://ftp.qtopia.org.cn/mirror/ftp.trolltech.com/qt/source/qt-win-opensource-src-4.2.2.zip
http://downloads.sourceforge.net/qtwin/acs-4.2.2-patch1.zip

前提
安装MS Visual C++ 2005 Express Edition(MSVC8)
http://msdn.microsoft.com/vstudio/express/

安装最新的Windows平台SDK
http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en

安装
把qt-win-opensource-src-4.2.2.zip解压后放到C:\Qt\qtwin-4.2.2。
把acs-4.2.2-patch1.zip复制到上述目录解压。会生成qtwin_patch目录和installpatch42.bat以及removepatch42.bat两个文件。
qtwin_patch下有个Readme42.txt文件,大家可以好好看看。
运行installpatch42.bat文件。
然后按上述Readme42.txt文件步骤执行。
修改C:\Program Files\Microsoft Visual Studio 8 Express\Common7\Tools\vsvars.bat文件。

代码:
@SET VSINSTALLDIR="c:"\Program Files\Microsoft Visual Studio 8
@SET VCINSTALLDIR="c:"\Program Files\Microsoft Visual Studio 8\VC
@SET FrameworkDir="c:"\WINDOWS\Microsoft.NET\Framework
@SET FrameworkVersion="v2".0.50727
@SET FrameworkSDKDir="c:"\Program Files\Microsoft Visual Studio 8\SDK\v2.0
@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR

@echo Setting environment for using Microsoft Visual Studio 2005 x86 tools.

@rem
@rem Root of Visual Studio IDE installed files.
@rem
@set DevEnvDir="c:"\Program Files\Microsoft Visual Studio 8\Common7\IDE
@set QTDIR="C:"\Qt\qtwin-4.2.2
@set QMAKESPEC="win32-msvc2005"

@set PATH=%QTDIR%\bin;c:\Program Files\Microsoft Visual Studio 8\Common7\IDE;c:\Program Files\Microsoft Visual Studio 8\VC\BIN;c:\Program Files\Microsoft Visual Studio 8\Common7\Tools;c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;c:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;%PATH%
@set INCLUDE=%QTDIR%\include;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include;c:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;%INCLUDE%
@set LIB=%QTDIR%\lib;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;c:\Program Files\Microsoft Visual Studio 8\VC\LIB;c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;%LIB%
@set LIBPATH="c:"\WINDOWS\Microsoft.NET\Framework\v2.0.50727

@goto end

:error_no_VSINSTALLDIR
@echo ERROR: VSINSTALLDIR variable is not set.
@goto end

:error_no_VCINSTALLDIR
@echo ERROR: VCINSTALLDIR variable is not set.
@goto end

:end


然后运行
Start->Programs->Visual C++ 2005 Express Edition->Visual Studio Tools->Visual Studio 2005 Command Prompt

代码:
C:
cd C:\Qt\qtwin-4.2.2
qconfigure msvc2005
nmake


Visual C++ 2005 Express Edition中的设置
VC 2005 EE中Tools->Options->Projects and Solutions->VC++ Directories
Exectuable中加入C:\Qt\qtwin-4.2.2\bin
Include files中加入C:\Qt\qtwin-4.2.2\include和C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
Library files中加入C:\Qt\qtwin-4.2.2\lib和C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib

Qt项目中生成VC项目文件的方法
手写.pro文件或者qmake -project
注: qmake -project并不是包办一切的方法,很多设置选项需要自己手动修改.pro文件的,相关内容请阅读qmake的文档。
代码:
qmake -t vcapp


 


http://www.linuxext.com/bbs/read.php?tid=12127

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
我要评论
0
3
关闭 站长推荐上一条 /3 下一条