1

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?

2
  • can you put all the code in a code block instead of bits and pieces? it would make it much easier to read and help you. thx Commented Oct 11, 2009 at 21:27
  • Note that you can't have everything in a single file like this? The form needs a header file, as moc will use this header file to generate a new file moc_form1.cpp with additional metadata about the class. Commented Oct 12, 2009 at 6:14

2 Answers 2

5

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments