From owner-freebsd-questions Thu Oct 12 17:55:45 2000 Delivered-To: freebsd-questions@freebsd.org Received: from web6305.mail.yahoo.com (web6305.mail.yahoo.com [128.11.22.142]) by hub.freebsd.org (Postfix) with SMTP id F0F8937B502 for ; Thu, 12 Oct 2000 17:55:42 -0700 (PDT) Message-ID: <20001013005542.27163.qmail@web6305.mail.yahoo.com> Received: from [64.161.130.86] by web6305.mail.yahoo.com; Thu, 12 Oct 2000 17:55:42 PDT Date: Thu, 12 Oct 2000 17:55:42 -0700 (PDT) From: Christian Lacunza Subject: Re: c++/qt lib compile error To: beemern@telecom.ksu.edu Cc: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 > #include > > 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