自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

使用 Qt 與 Visual C++ 2008 創(chuàng)建應(yīng)用程序事例

移動開發(fā)
本文介紹的內(nèi)容是如何使用 Qt 與 Visual C++ 2008 創(chuàng)建應(yīng)用程序,一個比較新穎的效果實(shí)現(xiàn),那么快來看本文內(nèi)容把。

在壇子里面逛,發(fā)現(xiàn)了一片好文章,為大家推薦一下。本文學(xué)習(xí)的目的::學(xué)會如何使用 Visual C++ 命令提示和生成文件項(xiàng)目創(chuàng)建一個簡單的Qt應(yīng)用程序步驟::

安裝 Qt libraries for windows(VS 2008), 該文件下載地址 http://qt.nokia.com/downloads , 選擇 LGPL. 還可在該地址下載 Qt SDK for Windows, qt-vs-addin.

增加環(huán)境變量 QTDIR, 其值為Qt的安裝目錄, 例如: D:\Qt-4.4.3. 修改環(huán)境變量 Path, 將 Qt的"bin"目錄添加至其內(nèi).

在一個新的目錄里創(chuàng)建 Hello.cpp 文件. 代碼如下:

  1. #include "QApplication"       
  2. #include "QPushButton"            
  3. int main(int argc, char *argv[])     {  
  4.          QApplication app(argc, argv);   
  5.         QPushButton hello("Hello world");  
  6.          hello.resize(100, 30);  
  7.               hello.show();  
  8.          return app.exec();  
  9.      }    
  10. #include "QApplication"    
  11. #include "QPushButton"    
  12.     
  13. int main(int argc, char *argv[])    
  14. {    
  15.     QApplication app(argc, argv);    
  16.     QPushButton hello("Hello world");    
  17.     hello.resize(100, 30);    
  18.     
  19.     hello.show();    
  20.     return app.exec();    

啟動 Visual Studio 2008 命令提示, 使用磁盤符號和cd命令移動至 hello.cpp 文件所在的目錄

鍵入 如下的命令

 

  1. qmake -project -0 hello.pro  
  2. qmake hello.pro  
  3. nmake 

這樣就在debug目錄中生成了文件 hello.exe

如果要使用 Visual Studio Express IDE, 還需要進(jìn)行一些步驟: 選擇菜單"工具>選項(xiàng)>項(xiàng)目和解決方案>VC++目錄", 在包含文件中增加"$(QTDIR)\include", "$(QTDIR)\include\QtCore", "$(QTDIR)\include\QtGui". 在庫文件中增加 "$(QTDIR)\lib".

創(chuàng)建一個新的項(xiàng)目("文件>新建>項(xiàng)目>Visual C++>常規(guī)>生成文件項(xiàng)目"), 名稱為"HelloQt"

選擇菜單"項(xiàng)目>屬性>配置屬性>NMake", 生成命令行中寫入"qmake -project && qmake && nmake release-all", 輸出中則寫"release\HelloQt.exe"

添加新文件"HelloQt.cpp", 輸入上面的代碼

使用快捷鍵 "Ctrl-F5" 或者菜單"調(diào)試>開始執(zhí)行(不調(diào)試)", 則生成了 HelloQt.exe

使用 Qt 與 Visual C++ 2008 創(chuàng)建應(yīng)用程序事例

小結(jié)::使用 Qt 與 Visual C++ 2008 創(chuàng)建應(yīng)用程序事例的內(nèi)容介紹完了,VS代碼顏色背景方案是不是挺炫的?嘿嘿,希望本文能對你有所幫助!

責(zé)任編輯:zhaolei 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2009-12-16 15:39:37

Visual Stud

2010-01-28 17:14:38

Visual C++應(yīng)

2010-01-22 13:59:34

Visual C++應(yīng)

2009-08-24 09:25:18

Visual C# ..NET應(yīng)用程序

2010-12-30 16:22:28

Visual C++用戶訪問協(xié)議

2011-07-20 17:23:29

C++持久對象

2010-01-12 14:45:32

Visual C++

2010-01-28 09:44:08

C++應(yīng)用程序

2010-01-26 17:16:33

C++應(yīng)用程序

2009-01-19 11:07:42

C#Web.NET

2010-01-14 11:14:47

C++應(yīng)用程序

2010-01-25 16:41:08

C++應(yīng)用程序

2011-06-09 09:12:12

QT symbian

2010-11-19 12:40:12

Visual Stud云應(yīng)用程序

2009-09-03 17:36:13

C#創(chuàng)建Web應(yīng)用程序

2009-08-25 09:39:21

創(chuàng)建C# Window

2009-08-28 16:43:08

AutoCAD托管C#

2023-12-10 14:43:30

PythonGUIeel

2009-08-14 17:27:30

C#Windows應(yīng)用

2021-05-07 08:00:19

應(yīng)用程序框架
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號