View Full Version: Qt3 Designer

C++ Learning Community > Computer Lab > Qt3 Designer


Title: Qt3 Designer


Dragon - December 29, 2003 06:09 AM (GMT)
I have Qt3 Designer and I have a C++ source file with this code in it (the code is from a tutorial):

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


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

   QPushButton hello( "Hello world!", 0 );
   hello.resize( 100, 30 );

   a.setMainWidget( &hello );
   hello.show();
   return a.exec();
}


This is the text for the project file I created:

CODE
SOURCE += tutorial.cpp


This is the command I used to generate a makefile with gmake:

CODE
gmake -o Makefile tutorial.pro


The text returned was:

CODE
gmake: Nothing to be done for `tutorial.pro'.


How do I use gmake to generate makefiles for my projects?

Incubator - December 29, 2003 06:18 PM (GMT)
your project file is incomplete

minimum specs:

CODE

TEMPLATE=app
SOURCE=tutorial.cpp \
               someothersourceperhaps.cpp


and you can just use the standard make :)

in windows though, you need to type nmake

Dragon - December 30, 2003 01:02 AM (GMT)
Thanks for the reply. :)

I will do what you said and see if it works. :)

EDIT

I found out that it's qmake and not gmake. I typed qmake in a terminal but it said the command was not found. Maybe qmake isn't installed? If so, where can I get qmake?

Suppose I have a C++ source file named source.cpp and I used Qt, how would I compile it? Thanks for your help. :)

Incubator - December 30, 2003 12:02 PM (GMT)
/usr/qt/3/bin/qmake

it may be it is not in your $PATH
or that $QTDIR is not set

if your sourcefile.cpp is just this simple and has no header with the Q_OBJECT macro then do this:

g++ -I. -I$QTDIR/include -L$QTDIR/lib -lqt sourcefile.cpp -o myprogram

and I noticed my info in the previous post was a bit confusing. Here is a correction:

use the .pro file I posted but add HEADERS=myheader.h
ONLY if you have a header
you can also add TARGET=myapp to set the executable name
then type
qmake -o Makefile myapp.pro
make

and in windows this make should be nmake

Dragon - December 31, 2003 05:00 AM (GMT)
Thanks for your help. I'll see if it works.




* Hosted for free by InvisionFree