[vox-tech] kde/qt programming question
Shwaine
vox-tech@lists.lugod.org
Sun, 7 Apr 2002 15:13:33 -0700
The problem is by creating a symlink, you only "fixed" finding the
headers for your program. It does nothing to help the compiler to
find the headers that other headers might include because they still
just include <blah.h>, not <qt/blah.h>. This is why you get those
errors after doing the symlink. What you need to do is remove the
symlink, put your program back in its original form and pass the
proper include directory to g++ when invoking the compiler. Try something
like:
g++ -I/usr/lib/qt2/include -o 1 1.cpp
Look at "man gcc" and "man g++" to learn how to use the compiler
and give it the proper command line args for a given situation.
Shwaine the Wandering Arch of Malevolence
--------------------------------------------------------------
http://www.malevolence.com http://www.shwaine.com
telnet://shwaine.dyn.greystoneapts.com:3000
On 7 Apr 2002 Patrick Stockton <codejnki@codejnki.com> wrote:
>
> 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.