VC 2005/2008 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.

     

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值