Qt related problem

August Hörandl august.hoerandl at gmx.at
Tue Mar 13 23:27:39 GMT 2001


Christian Menke wrote:
> 
> Hello!
> I'm having a bit of trouble getting applications compiled when I use qt.
> I've written a very small program that is meant to do nothing but be
> there and close when a button is clicked.
> My problem is that g++ cannot find qapplication.h and qpushbutton.h:
> 
> cmenke at davion:~/cpp$ g++ -o qt-sample qt-sample.cc
> qt-sample.cc:1: qapplication.h: No such file or directory
> qt-sample.cc:2: qpushbutton.h: No such file or directory
> cmenke at davion:~/cpp$ locate qapplication.h
> /usr/lib/qt2/include/qapplication.h
> 
> After having bugged a few people on IRC and found out that these includes
> should be in /usr/lib/qt/ rather than /usr/lib/qt2/include, and thus I
> tried pointing g++ to the directory where my qapplication.h and stuff
> reside:
> 
> cmenke at davion:~/cpp$ g++ -I/usr/lib/qt2/include/ -o qt-sample qt-sample.cc
> /tmp/cclt7tiz.o: In function `main':
> /tmp/cclt7tiz.o(.text+0x18): undefined reference to
> `QApplication::QApplication(int &, char **)'
> /tmp/cclt7tiz.o(.text+0x44): undefined reference to
> `QString::QString(char const *)'
> /tmp/cclt7tiz.o(.text+0x57): undefined reference to
> `QPushButton::QPushButton(QString const &, QWidget *, char const *)'
> 
> Well, that time, g++ obviously found the includes, but something....
> well... something went wrong again :-)

one of the troubles of c/c++: the header files don't include information
about the libraries to be included

with your -I.... g++ is able to find the header files - but g++ doesnt
know
which library to include

just add
 -L/usr/lib/qt2/lib  -lqt 
to the command line (-L path/to/library, -l name/of/library)

HTH
Gustl
-- 
August Hörandl                  Printer not ready.
august.hoerandl at gmx.at          Could be a fatal error.
                                Have a pen handy?
                                --Pat Davis

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list