Monday, July 7, 2008

Writing, compiling and executing a Qt program on Windows XP

Hi all,

To compile a qt program first make a folder and make a cpp file in this folder and add the appropriate code. For your reference I created a C:\Qt\First and then added a main.cpp with the following contents:
#include
#include

int main(int argc, char* argv[])
{
QApplication app(argc,argv);
QPushButton button;
button.setText("FIRST BUTTON");
button.show();
return app.exec();
}

Then execute the following standard commands one by one:
qmake -projects
qmake
make
This will create 3 make files namely Makefile, Makefile.Debug, Makefile.Release.
To create an executable: type the command: make -f Makefile.Release
This creates a release folder. The executable is in this release folder. Change to this folder and execute the exe.
Remember that every time you change your code, compile your program with the above command to recreate the release which reflects the changes that you have made.
That's it you are on your way to bigger things in Qt

HAPPY PROGRAMMING
For any queries leave your comments and I will get back to you soon.

Cheers!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

MANDELBROT

1 comment:

MEDAMPUDI said...

I am having a problem with the in the mingw32-g++..... Could you help me in this matter.. I have uploaded a screen shot on my blog...
http://thethoughtsofawanderingmind.blogspot.com/