淺析QT Wince 開發(fā)指南
環(huán)境搭建
VS2008 OR VS2005SP1 中英文都可以 一個搭載WINCE 的開發(fā)板(或wince windows 的手機(jī)),QT Creator IDE(我用這個感覺不錯,如果你喜歡vs 也可以用VS開發(fā))
qt-everywhere-opensource-src-4.7.1.zip 這是現(xiàn)在的***版本,如果你要用的話,請下你當(dāng)前的***版本。
把qt-everywhere-opensource-src-4.7.1.zip 解壓 我放到的目錄是
F:\qtwince下,打開vs2008 的命令提示符 ,在 "開始"->Microsoft Visual Studio 2008->Visual Studio Tools 中可以找到
- Setting environment for using Microsoft Visual Studio 2008 x86 tools.
- c:\Program Files\Microsoft Visual Studio 9.0\VC>
配置環(huán)境變量
F:\>set path=%PATH%;F:\qtwince;F:\qtwince\bin
你自己的請自已改下.
到你的目錄下進(jìn)行config
- F:\qtwince>configure -platform win32-msvc2008 -xplatform wince60standard-armv4i-msvc2008
wince60standard-armv4i-msvc2008 這個可以根據(jù)F:\qtwince\mkspecs文件夾下的內(nèi)容,再和你自己的目標(biāo)板子自己設(shè)置。
然后就開始進(jìn)行makefile的配置了
代碼
- Which edition of Qt do you want to use ?
- Type 'c' if you want to use the Commercial Edition.
- Type 'o' if you want to use the Open Source Edition.
- o
- This is the Qt for Windows CE Open Source Edition.
- You are licensed to use this software under the terms of
- the GNU Lesser General Public License (LGPL) version 2.1
- or the GNU General Public License (GPL) version 3.
- Type '3' to view the GNU General Public License version 3 (GPLv3).
- Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1).
- Type 'y' to accept this license offer.
- Type 'n' to decline this license offer.
- Do you accept the terms of the license?
- y
完成后再根據(jù)你自己的機(jī)器配置環(huán)境,我有一個開發(fā)板,和一個M8手機(jī),所以我給兩個配置你可以按你自己的來
開發(fā)板的
- set INCLUDE=%VSINSTALLDIR%\VC\ce\include;%ProgramFiles%\Windows CE Tools\wce600\android6410_SDK\Include\Armv4i;%INCLUDE%
- set LIB=%VSINSTALLDIR%\VC\ce\lib\armv4i;%ProgramFiles%\Windows CE Tools\wce600\android6410_SDK\Lib\ARMV4I;%LIB%
- set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_arm;%PATH%
M8手機(jī)的
- set INCLUDE=%VSINSTALLDIR%\VC\ce\include;%ProgramFiles%\Windows CE Tools\wce600\M8SDK\Include\Armv4i;%INCLUDE%
- set LIB=%VSINSTALLDIR%\VC\ce\lib\armv4i;%ProgramFiles%\Windows CE Tools\wce600\M8SDK\Lib\ARMV4I;%LIB%
- set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_arm;%PATH%
支接就可以
nmake
如果你想快些的話也可以不用nmake而用QT Creator下的jom 但我用過一次,不太穩(wěn)定,而且I5CPU 四核95%++,剛沒跑多長時間我的本本就黑了。應(yīng)該是CPU太高過熱了。
為了穩(wěn)定的話還是要用nmake 的好些.
請確保你有足夠的空間,一般會占3G左右
運行完成后可以使用
nmake clean 來清空臨時文件減少使用空間.
現(xiàn)在就可以進(jìn)行開發(fā)了,寫個測試的例子。
編譯的時候***用命令,不知道為什么我用QT Creator 一直沒編譯成功.
命令行下,進(jìn)行vs2008 命令提示符 把上面的環(huán)境再運行一次。
這次要把F:\qtwince\bin也加進(jìn)去
qmake.exe test.pro -r -spec wince60standard-armv4i-msvc2008
nmake
就可以在文件夾中找到編譯好的exe 程序了,如果只要release 的就輸入nmake release
把release 出來的exe 文件和F:\qtwince\lib\下的 QtCore4.dll,QtGui4.dll
還有C:\Program Files\Microsoft Visual Studio 9.0\VC\ce\dll\armv4i 下的msvcr90.dll一起復(fù)制到開發(fā)板上運行下吧。
【編輯推薦】