❶ 討論上Windows平台怎麼編譯Qt5
Qt5的編譯官方有一篇wiki:http://developer.qt.nokia.com/wiki/Building_Qt_5_from_Git
簡要的總結下我的體會,歡迎補充完善、批評指正。
1.First clone the top-level qt5 git repository:
git clone git://gitorious.org/qt/qt5.git qt5
這一行不用說了,自然是將Qt5的代碼克隆。不過,如果你只是初次克隆Qt5的代碼,會很驚訝:為何克隆後的代碼只有十幾MB?
原來,Qt5已經實現了Qt的模塊化,詳見:http://labs.qt.nokia.com/2011/05/12/qt-moles-maturity-level-the-list/
所以可以在克隆得到的Qt5源碼根目錄下看到:.gitmoles 文件,其內容部分摘錄如下:
[submole "qtbase"]
path = qtbase
url = git://gitorious.org/qt/qtbase.git
[submole "qtsvg"]
path = qtsvg
url = git://gitorious.org/qt/qtsvg.git
[submole "qtdeclarative"]
path = qtdeclarative
url = git://gitorious.org/qt/qtdeclarative.git
...
這時,有Git基礎的朋友一定會想到:
git submole init
git submole update
不過,請不要這樣做!
2. Following the README file we initialize the repository. This clones the various sub-moles of Qt5:
./init-repository
這是一個perl腳本。如果是在msys-git下,會發現Perl的版本不夠。
我們需要安裝一個Windows版本的Perl:http://www.activestate.com/activeperl/downloads
安裝好以後,Perl就添加到PATH環境變數中去了。
在MSVC的控制台下執行:
perl init-repository --help
注意,不是直接執行init-repository,要用perl來執行它。看看幫助:大致了解下有哪些功能。
3. 注意它的三個小提示:
Hint1: If you』re going to contribute to Qt 5, you』ll need to pass the —codereview-username <Jira/Gerrit username> option to set up a 「gerrit」 remote for all the sub-moles.
Hint2: If you』re having problems downloading the webkit repository (which is quite big), you can pass —no-webkit.
Hint3: If you』re behind a firewall, pass —http
4. 我的方法:
perl init-repository -f --codereview-username loaden
這樣就可以實現子模塊的批處理了。特別要注意的是:在處理這些子模塊時,其實是git clone了這些子模塊,以致於他們可以獨立使用。在qt5\qtbase目錄下可以找到.git目錄。
這與git submole update的結果是不一樣的!!
同時我使用了codereview的用戶名,是為了可以創建一個名為gerrit的遠程倉庫,可以將貢獻的代碼推送進去,類似:
git push gerrit HEAD:refs/for/master
5. 源碼下載是非常慢的,因為QtWebkit達到了1.7GB。源碼下載完成後,進入Qt5源碼目錄,配置環境變數:
set PATH=%CD%\qtbase\bin;%PATH%
之後echo看一下結果是否正確:
echo %PATH%
6. 建議直接在Qt5的源碼目錄下執行配置!
configure -confirm-license -opensource -release -shared -platform win32-msvc2010 -fast -no-stl -no-qt3support -nomake examples -nomake demos -nomake tests
7. 編譯全部模塊,直接執行nmake就可以了。如果只編譯一個模塊,可以這樣:
nmake mole-qtbase
雙擊打開Qt5目錄下的Makefile文件,可以看到有這些模塊:
SUBTARGETS = \
mole-qtbase \
mole-qtsvg \
mole-qtphonon \
mole-qtxmlpatterns \
mole-qtdeclarative \
mole-qttools \
mole-qttranslations \
mole-qtdoc \
mole-qlalr \
mole-qtqa \
mole-qtlocation \
mole-qtactiveqt \
mole-qtsensors \
mole-qtsystems \
mole-qtmultimedia \
mole-qtfeedback \
mole-qtquick3d \
mole-qtdocgallery \
mole-qtpim \
mole-qtconnectivity \
mole-qtwayland \
mole-qtjsondb \
sub-qtwebkit-pri \
mole-qtwebkit-examples-and-demos
❷ 大學初學c語言,用哪種c語言編譯器能兼容win10系統
兼容win10系統的太多了,比如常用的vc++6.0,vs,甚至集成wingw的Qt都可以,不過學c語言最好的平台還是在linux上。
vc++6.0比較老了,雖然輕便但考慮到和win10的兼容性應該不太好。
vs是window世界最強大的c/c++開發工具,無論是編輯還是調試都非常人性化,而且還可以在官網下載社區版(正版且免費)。不過vs2015還是只能編譯32位應用,另一個缺點是安裝vs需要很大的磁碟空間和時間,我當初安裝消耗了接近20G,時間花費了好幾個小時(好吧我的網速比較慢電腦性能不好也許是個因素)。
Qt是跨平台的圖形編輯器,你可以使用集成了wingw的qt編譯windows程序,也可以使用windows上已經安裝的編譯器比如vs的編譯器。其他諸如eclipse有沒有集成編譯器你可以自己查一下。
❸ 在linux下,QT怎樣編譯出windows程序
你好,1、可以安裝cygwin,Cygwin是一個在windows平台上運行的類UNIX模擬環境,是cygnus solutions公司開發的自由軟體,搜索官網下載即可,下載完成,安裝的時候注意記得安裝相關語言的編譯器、解釋器,在cygwin中生成Linux可執行文件。2、 可以安裝vmware、virtualpc等虛擬機,在虛擬機里安裝linux系統,然後在linux系統中編譯相應的源碼,生成linux上的可執行文件。