XP下QT4命令行编译(转)

来源:互联网 发布:vb讲excell导到数据库 编辑:程序博客网 时间:2024/06/01 09:05

首先新建一个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

我出问题就在红色标注处,我是直接运行make,提示没有这个命令,在网上查找后看到这个帖子,自己运行了一下,OK,在这里做个记录,也为了让更多的人看到吧。

原创粉丝点击