LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-05-2004, 04:17 PM   #1
stackoverflow32
LQ Newbie
 
Registered: Aug 2004
Posts: 6

Rep: Reputation: 0
Undefined references when linkin against Debian packaged libs


Hi,

My program uses several dynamic libraries. TagLib is one of them and so I installed it via apt-get on my dev system. But when linking against TagLib via: g++ -ltag mysources-that-use-taglib.cpp
I got a lot of errors of undefined references to methods from TagLib.
That time I downloaded the sources for TagLib and built and installed the source tarball manually and guess what ? No linking errors ! I thought that the taglib debian package was broken and had no symbols in it that i could link against so didnt mind.

Now its the same situation again. I extended the program to use the xerces-c xml parser library from the Apache Project. Again I installed the necessary debian packages libxerces25 and libxerces25-dev.
This time I got exactly the same mess when trying to compile. Undefined references !!!

And here is my final question: Is there something special about linking to debian packaged libraries or did I use the wrong type of linking command. Currently I use : g++ -lxerces-c -lanylib source.cpp

Every library is found by the way. It just seems as if there were no symbols or references to link against.

Help me !! Im stuck with the whole project until I figured this out.

Thanks in advance,
Marc
 
Old 08-05-2004, 04:33 PM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 58
Have you tried running ldconfig as root?
 
Old 08-06-2004, 12:45 PM   #3
stackoverflow32
LQ Newbie
 
Registered: Aug 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Yes, I ldconfig'ed every time I installed a new library.
I might mention that its a mixed unstable/testing system so maybe there are problems between a unstable version of g++ and testing libraries ?
 
Old 08-08-2004, 02:09 PM   #4
stackoverflow32
LQ Newbie
 
Registered: Aug 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Finally solved it !
apt-get held the g++ package back and hence I had real testing library packages but the old 2.9 G++ compiler. In c++ compilers have to extend a normal method name like Playlist::add by additional characters because there can be several Playlist::add methods around. This is called name mangling as i know and g++ 2.9 to 3.3 had a change in its name mangling routines and so libraries compiled for g++ 3.3 have different symbols than g++ 2.9 would expect. -> undefined references.

I now get back to business correcting the bunch of errors g++ 3.3 now complains about. Its much more sensible than the old one .

Ciao,
Marc
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined references with static libraries Nightfox Programming 2 10-28-2005 06:43 PM
texinfo - undefined references during make fitret Linux - Software 1 06-18-2005 02:38 PM
Recommend your favorite Debian packaged games! R00ts Debian 4 12-08-2004 10:28 AM
Qt 3.3.3 undefined references when linking Ch. 7 tutorial QtCoder Programming 3 11-07-2004 11:59 AM
why compiler gives undefined references on static members??? Hano Programming 8 06-26-2002 11:12 AM


All times are GMT -5. The time now is 01:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration