Compile a quick project in Qt?
I want to compile this application in a command prompt (Windows):
include "QtGui/QApplication"
include "QtGui/QMainWindow"
class Form1 : public QMainWindow
{
Q_OBJECT
public:
Form1(QWidget *parent = 0, Qt::WFlags flags = 0);
~Form1();
};
Form1::Form1(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags)
{
}
Form1::~Form1()
{
}
int main(int argc, char * argv[])
{
开发者_开发技巧 QApplication a(argc, argv);
Form1 * frm = new Form1();
frm->setWindowTitle("Hello Word !!!");
frm->show();
return a.exec();
}
What should I do?
Open the Qt Command Prompt and type:
qmake -project
qmake
make
Alternatively, you could download Qt Creator to have a nice lightweight IDE that lets you compile your application by pushing a button :)
Look an one of the numerous examples and demos supplied with Qt, copy an existing .pro file and adapt it to your use.
Then copy the resulting compile instruction into a batch file, shell script, Makefile, emacs 'compile-command' variable, ... or whatever you prefer over the .pro file. I have chose the emacs 'compile-command' route myself for some small Qt test apps and test cases.
精彩评论