Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Oct 2000 17:55:42 -0700 (PDT)
From:      Christian Lacunza <celacunza@yahoo.com>
To:        beemern@telecom.ksu.edu
Cc:        freebsd-questions@freebsd.org
Subject:   Re: c++/qt lib compile error
Message-ID:  <20001013005542.27163.qmail@web6305.mail.yahoo.com>

next in thread | raw e-mail | index | archive | help

hi nathan.

your error messages are coming from the linker.
you need to tell it where too look for the Qt libraries.
on by system, your code works fine like this:

     $ g++ qt.cc -I /usr/X11R6/include/qt2 -L /usr/X11R6/lib -lqt2
     $ ./a.out

because my Qt libraries are here:

     $ locate libqt
     /usr/X11R6/lib/libqt2.so
     /usr/X11R6/lib/libqt2.so.3
     $ 

if yours are elsewhere, just change the argument to the -L switch.

-- christian.



> I know this isn't fbsd specific but...
> 
> i'm tryin to follow a qt tutorial to get started with the qt libraries.
> when tryin to compile 'hello world' :
> --snip--
> #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();
> }
> --snip--
> 
> i get this:
> 
> --snip--
> [nathan@sabre src]$ g++ -I/usr/local/qt/include hello_qt.cc
> /tmp/ccJ85228.o: In function `main':
> /tmp/ccJ85228.o(.text+0x28): undefined reference to
> `QApplication::QApplication(int &, char **)'
> /tmp/ccJ85228.o(.text+0x3f): undefined reference to
> `QApplication::~QApplication(void)'
> /tmp/ccJ85228.o(.text+0x5e): undefined reference to
> `QString::QString(char const *)'
> /tmp/ccJ85228.o(.text+0xa8): undefined reference to
> `QPushButton::QPushButton(QString const &, QWidget *, char const *)'
> /tmp/ccJ85228.o(.text+0xe7): undefined reference to
> `QPushButton::~QPushButton(void)'
> /tmp/ccJ85228.o(.text+0x10e): undefined reference to
> `QPushButton::resize(int, int)'
> /tmp/ccJ85228.o(.text+0x124): undefined reference to
> `QApplication::setMainWidget(QWidget *)'
> /tmp/ccJ85228.o(.text+0x136): undefined reference to
> `QWidget::show(void)'
> /tmp/ccJ85228.o(.text+0x145): undefined reference to
> `QApplication::exec(void)'
> /tmp/ccJ85228.o(.text+0x169): undefined reference to
> `QPushButton::~QPushButton(void)'
> /tmp/ccJ85228.o(.text+0x188): undefined reference to
> `QApplication::~QApplication(void)'
> /tmp/ccJ85228.o: In function `QString::~QString(void)':
> /tmp/ccJ85228.o(.gnu.linkonce.t._$_7QString+0x29): undefined reference
> to `QStringData::deleteSelf(void)'
> [nathan@sabre src]$
> --snip--
> 
> i've looked in my -I arg dir and it DOES contain the .h files in the
> source.
> 
> what gives?



__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001013005542.27163.qmail>