- 论坛徽章:
- 0
|
windows7下命令行编译QT程序
首先新建一个QT4的应用程序
#include QApplication>
#include QPushButton>
int main(int argc,char* argv[])
{
QApplication app(argc,argv);
QPushButton * bt = new QPushButton("quit");
QObject::connect(bt,SIGNAL(clicked()),&app,SLOT(exit()));
bt->show();
return app.exec();
}
保存为a.cpp,放到I:
打开qt command prompt
I:\>qmake -project -o a.pro
I:\>qmake a.pro
I:\>mingw32-make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `I:/'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -mthreads -Wl -Wl,-subsystem,windows -o debug\a.exe debug/a.o -L"c:\Qt\2009.
05\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `I:/'
I:\>cd debug
I:\debug>dir
驱动器 I 中的卷是 RamDisk
卷的序列号是 4438-2575
I:\debug 的目录
2010/01/22 21:10 DIR> .
2010/01/22 21:10 DIR> ..
2010/01/22 21:09 461,877 a.exe
2010/01/22 21:01 116,634 a.o
2 个文件 578,511 字节
2 个目录 64,843,776 可用字节
I:\debug>a.exe
这样就完成了编译,可以运行a.exe
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/98826/showart_2158058.html |
|