Qt初體驗

發表於 五月 1, 2008. 分類: Qt |

Qt 略有所聞,只是很少接觸,以下是用Visual C++ 6.0 的 nmake 安裝 Qt 的過程,目前可能無法記載很詳細,因為暫時想看看怎麼用 Qt 來寫 UI。
Qt source for windows: qt-win-opensource-src-4.3.4.zip
Qt Visual Studio Patch: acs-4.3.x-patch3.zip
windows platform: Microsoft Windows XP SP2
IDE Tool: Microsoft Visual C++ 6.0 Enterprise update to Service Pack 6

  1. 安裝好 Visual C++ 6.0,再將 qt-win-opensource-src-4.3.4.zip 解壓縮到 c:\Qt\4.3.4 的目錄下。
  2. 將 acs-4.3.x-patch3.zip 解壓縮到 c:\Qt\4.3.4 目錄下。
  3. 開啟 console mode,切換到 Visual C++ 6.0 的安裝目錄,在我的電腦上的路徑如下
    C:\Program Files\Microsoft Visual Studio\VC98\Bin,然後執行 VCVARS32.BAT 讓 VC 暫時設定 PATH(我有先將 PATH 清除)。
  4. 之後再切換到 c:\Qt\4.3.4 目錄,執行 nmake /? ,是否可以正確執行 nmake。
  5. 執行 Visual Studio patch of Qt,輸入 installpatch43.bat
  6. 再執行 qconfigure msvc,可是一直出現 NMAKE : fatal error U1073: don’t know how to make ‘..\src\core\global\qconfig.cpp‘ Stop. 的訊息,無法 configure 我的環境,所以我直接用 configure -platform win32-msvc 來 configure。
  7. 完成之後再輸入 nmake,接下來是一連串的等待……。
  8. 接下來設定 Qt 的路徑,開始 | 設定 | 控制台 | 系統 | 進階 | 環境設定 | PATH | 編輯 | 加上 c:\Qt\4.3.4\bin
  9. 闗掉剛剛的 console mode,重新開啟一個 console mode,輸入 qmake -v,是否能正常執行。
  10. Create Visual Studio projects
    1. 建立一個 testQt 的資料夾。
    2. 將 console mode 路徑切換到 testQt 目錄下,先用記事本寫一個測試程式碼,可到此網址看一下 http://qtnode.net/wiki?title=Hello_World ,完成後再輸入 qmake -project -t vcapp -o testQt.pro,之後會產生一個 testQt.pro。
    3. 再輸入 qmake,會再產生一些檔案及目錄,其中有一個為 testQt.dsp,請用 Visual C++ 6.0 開啟。
    4. 試著編譯剛剛所寫的測試檔,且 Build 一個可執行檔出來執行看看。
  11. 至於 Qt Library 的路徑已在 qmake 時所產生的 dsp 檔內都設定好了,所以 VC++ 6.0 開啟時都在裡面設定了,可以到 Porject Settings… 裡面的 Link 去看看 Qt 所幫你設定的路徑。

Make a Comment

發表迴響

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

連結到 %s

Liked it here?
Why not try sites on the blogroll...

Follow

Get every new post delivered to your Inbox.