[vox-tech] kde/qt programming question

Patrick Stockton vox-tech@lists.lugod.org
Sun, 7 Apr 2002 13:20:32 -0400


I'm starting to read a few tutorials on kde/qt programming

One of the first programs they have you do has the following source:

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

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

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

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

When I first tried to compile it using "g++ 1.cpp -o 1" it gave me errors:
1.cpp:1:30: qapplication.h: No such file or directory
1.cpp:2:29: qpushbutton.h: No such file or directory

That said to me that it couldn't find the right libraries.
So from inside my /usr/include directory I did a:
ln -s /usr/lib/qt2/include qt2

and then modified the two include lines to read:
#include <qt2/qapplication.h>
#include <qt2/qpushbutton.h>

Well now I am getting:

In file included from /usr/include/qt2/qobjectdefs.h:42,
                 from /usr/include/qt2/qwindowdefs.h:43,
                 from /usr/include/qt2/qwidget.h:42,
                 from /usr/include/qt2/qapplication.h:42,
                 from 1.cpp:1:
/usr/include/qt2/qglobal.h:448:23: qfeatures.h: No such file or directory

Now qglobal.h and qfeatures.h are both inside the /usr/include/qt2 directory
so I know it's not a problem of the files not being there.  How or what
should I edit path/shell variable wise to get the compiler to look in all the
right spots to find all the right header files.

Thanks in advance

Patrick

P.S.:
If anbody knows of a good programming tutorial for c/c++ on linux that goes
beyond your basic Hello World and on to something more advanced like how to
write say a basic text editor to teach you things could you send me the link?
 I've been searching google for a week now and just haven't found quite the
right thing.

Patrick

-------------------------------------------------------