VC 2005/2008 QT 安装

本文介绍如何在Visual C++ 2005 Express Edition和Visual C++ 2008 Express Edition上安装并配置QT进行开发。包括安装必要的软件、设置环境变量、配置QT、创建测试项目等步骤。

VC2005:

1. 安装Visual C++ Express Edition 2005

2. 安装Microsoft Platform SDK for Windows Server 2003 R2--Visual C++ Express Edition 2005本身不含windows sdk。下载地址:http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en

3. 安装QT。目前最新版本为4.5.0. 下载地址:http://www.qtsoftware.com/downloads 安装目录为c:/qt/4.5.0

4. 设置编译QT

a)打开命令行

设置VC变量:  C:/Program Files/Microsoft Visual Studio 8/Common7/Tools/vsvars32.bat

设置SDK变量: C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2/SetEnv.Cmd  

配置QTcd c:/qt/4.5.0

               configure -platform win32-msvc2005 -debug -no-dsp –vcproj

编译QTnmake

b)增加环境变量SYSTEM PATH c:/qt/4.5.0/lib;c:/qt/4.5.0/bin

 

5. VC增加环境变量

VC Options->Projects and Solutions->VC++ Directories:

           Include files: c:/qt/4.5.0/include c:/qt/4.5.0/include/Qt c:/qt/4.5.0/include/QtGui c:/qt/4.5.0/include/QtCore

           Library files: c:/qt/4.5.0/lib

 

6. 创建一个QT工程,在一个空白目录如 c:/qtproject/helloworld 添加一个文件main.cpp,main.cpp中加入以下代码,

           #include <QApplication>

           #include <QLabel>

  

           int main(int argc, char** argv)

          {

              QApplication app(argc,argv);

              QLabel* label = new QLabel("Hello world");

              label->show();

              return app.exec();

          } 

          打开命令行

          cd c:/qtproject/helloworld 

          qmake -project -t vcapp helloworld.pro(生成helloworld.pro)

          qmake  (生成helloworld.vcproj)

          这时就可以打开helloworld.vcproj了,编译之后若能看到以下界面出现,恭喜,QT安装成功!

VC2008:

  1. Install VC2008 Express online by vcsetup.exe.
  2. Download QT for VC2008 and install to PC.
  3. Config QT

           set vc variables    C:/Program Files/Microsoft Visual Studio 9.0/Common7/Tools/vsvars32.bat

           configure Qt         cd c:/qt /4.5.0

                              configure -platform win32-msvc2008 -debug -no-dsp -vcproj      

           compile Qt           nmake                                                                                     

 

 

  1. Write sample file main.cpp to test the installation.

 

      #include <QApplication>

      #include <QLabel>

     

      int main(int argc, char** argv)

      {

          QApplication app(argc,argv);

          QLabel* label = new QLabel("test");

          label->show();

          return app.exec();

      } 

      go to the dir which main.cpp located.

      qmake –project  

      qmake –tp vc

      open .sln to build and run the sample app.

     

 

 

\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib 的目录 2009-09-06 16:17 . 2009-09-06 16:17 .. 2006-03-03 23:19 13,712 Bits.Lib 2006-03-03 23:19 4,196 credui.lib 2006-03-03 23:19 57,730 daouuid.lib 2006-03-03 23:19 527,310 ddao35.lib 2006-03-03 23:19 531,012 ddao35d.lib 2006-03-03 23:19 528,038 ddao35u.lib 2006-03-03 23:19 532,702 ddao35ud.lib 2006-03-03 23:19 14,610 WinFax.Lib 2006-03-03 23:19 206,996 GdiPlus.lib 2006-03-03 23:20 27,500 HelpCenterInterfaces.tlb 2006-03-03 23:20 64,608 HelpServiceInterfaces.tlb 2006-03-03 23:21 13,252 p2p.lib 2006-03-03 23:21 11,218 p2pgraph.lib 2006-03-03 23:21 1,380,352 atlsd.pdb 2006-03-03 23:23 121,974 WiaGuid.Lib 2006-03-03 23:23 19,212 WiaScr.Tlb 2006-03-03 23:23 10,152 esebcli2.lib 2006-03-03 23:23 129,732 cdoex.tlb 2006-03-03 23:23 26,608 cdoexm.tlb 2006-03-03 23:23 10,832 exevtsnk.tlb 2006-03-03 23:23 7,888 ActiveDS.Lib 2006-03-03 23:23 99,122 ADSIid.Lib 2006-03-03 23:23 53,222 Wldap32.Lib 2006-03-03 23:23 55,600 CDOSys.Tlb 2006-03-03 23:23 6,254 certadm.lib 2006-03-03 23:23 217,676 certidl.lib 2006-03-03 23:23 59,044 Crypt32.Lib 2006-03-03 23:23 5,516 ComSvcs.Lib 2006-03-03 23:23 75,386 DtcHelp.Lib 2006-03-03 23:23 2,106 Mtx.Lib 2006-03-03 23:23 1,734 mtxdm.lib 2006-03-03 23:23 121,030 Svcguid.Lib 2006-03-03 23:23 63,400 xaSwitch.Lib 2006-03-03 23:23 3,364 xoleHlp.Lib 2006-03-03 23:23 6,402 Icm32.Lib 2006-03-03 23:23 1,978 Icmui.Lib 2006-03-03 23:23 17,036 Mscms.Lib 2006-03-03 23:23 620,890 MMC.Lib 2006-03-03 23:23
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值