tags:

views:

115

answers:

2

I want to compile this application in 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();
}

Can anyone help me? What should I do?

A: 

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.

Dirk Eddelbuettel
+4  A: 

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 :)

nmuntz