Windows下Qt編譯環境搭建及編譯命令 (轉)

1、安裝QT4.8.0SDK(QTCreator2.4)
2、安裝MinGw(Qt4.8.0SDK)
3、在QtCreator\工具\選項\構建和運行\Qt版本\添加,選擇qmake路徑,如d:\qt\4.8.0\bin\qmake.exe
4、添加qmake所在目錄到環境變量,如D:\Qt\4.8.0\bin\
5、添加mingw32-make目錄到環境變量,如D:\Qt\qtcreator-2.4.1\mingw\bin\
6、MSWindows下編譯命令
qmake -o Makefile xxx.pro
mingw32-make
a、程序文件:main.cpp,hello.pro,hello.h,hello.cpp
b、創建makefile文件:
qmake -o Makefile hello.pro
生成Makefile、Makefile.Debug、Makefile.Release文件及debug、release空文件夾

c、執行makefile文件,編譯程序:mingw32-make
debug文件夾下生成hello.exe文件及
d、執行hello.exe文件,運行程序


命令組合2 qmake -project 生成.pro文件,再用qmake生成Makefile文件,make(會自動執行mingw32-make)生成可執行程序
把ui文件轉換層.h文件,(xml->cpp):uic -o mainwindow.h mainwindow.ui
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章