1. 程式人生 > >(QT)在命令行編譯ui文件和程序

(QT)在命令行編譯ui文件和程序

不能 lease eas ets 編譯 分享 min des cmd

1.新建helloworld_2文件夾,將helloworld裏的main.cpp和hellodialog.cpp兩個文件復制過來。

2.打開控制臺。此時不能用cmd,否則不能出最後的結果(lz在運行到mingw32-make這一步的時候就出現問題了),要在開始-QT裏找到QT5.5 for desktop控制臺,然後運行。雖然裏面關於控制臺的規則都一樣,但只有後者能出正確結果。

輸入E:,按回車,進入E文件夾,輸入cd QT\helloworld_2,按回車,進入helloworld_2文件夾。

3.uic -o ui_hellodialog.h hellodialog.ui

4.qmake -project

然後打開helloworld_2.pro,在裏面輸入QT +=widgets 保存退出。

5.qmake

6.mingw32-make

7.cd release

8.helloworld_2.exe

然後就可以看到運行結果了。

技術分享

(QT)在命令行編譯ui文件和程序