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.

     

 

 

你可能感兴趣的:(c,windows,Microsoft,express,qt,variables)