PDA

View Full Version : How to make .pro files



merry
8th March 2007, 07:13
Hi all

I m using Qt3.1(Linux Operating System) and tried to make Simple Hello Word Program. with the filename hello.cpp

Here the code is:


#include <qapplication.h>
#include <qpushbutton.h>

int main( int argc,char **argv )
{
QApplication a( argc, arg v);

QPushButton hello( "Hello World!",0);
hello.resize( 100, 30);
a.setMainWidget( &hello );
hello.show();
return a.exec();
}

when i write qmake hello.cpp at commad line

i got:



[root@localhost root]# qmake hello.cpp
hello.cpp:4: Unknown test function: int main
hello.cpp:6: Unknown test function: QApplication a
hello.cpp:8: Unknown test function: QPushButton hello
hello.cpp:9: Unknown test function: hello.resize
hello.cpp:10: Unknown test function: a.setMainWidget
hello.cpp:11: Unknown test function: hello.show
hello.cpp:12: Unknown test function: return a.exec



What it mean and what should I do?
or For this I have to make pro file
if yes then Plese Tell me how can I make pro files


Thanx

Merry

camel
8th March 2007, 08:57
I m using Qt3.1(Linux Operating System)


Why do you use Qt 3.1? If there is not strong reason for it I would suggest going with Qt 4.x as it is more future proof ;-)



when i write qmake hello.cpp at commad line


I would suggest reading the qmake user guide (http://doc.trolltech.com/3.1/qmake-manual.html) as you seem to have the wrong idea about what qmake is.

To quote the above linked manual:

qmake is a tool created by Trolltech to write makefiles for different compilers and platforms.

So you would not call it with implementation files directly. If you do not want to read the whole manual, read the 10 minute guide to using qmake (http://doc.trolltech.com/3.1/qmake-manual-3.html) which should hopefully tell you how to get the result you desire ;-)



Good Luck :-)

smacchia
8th March 2007, 20:46
Yes you should review the qmake documentation. But a quick answer is:

cd <development directory>
qmake -project [-o <optional name of project file>]
qmake
make