943,515 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1129
  • C++ RSS
May 22nd, 2008
0

undefined reference

Expand Post »
Hi guys ! This has been killing me for 8 hours

Things work well I'm compiling this way :
Quote ...
g++ -Wall -o prog prog.cpp -L/usr/local/sesam/lib -Wl,-rpath /usr/local/sesam/lib -Wl,-rpath,/usr/sesam/lib -ldl -lc
But when I add a link to /usr/local/sesam/lib/libssv.so that i need
Quote ...
g++ -Wall -o prog prog.cpp -L/usr/local/sesam/lib -lssv -Wl,-rpath /usr/local/sesam/lib -Wl,-rpath,/usr/local -ldl -lc
I get :
Quote ...
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « ios virtual table»/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « ws(istream &) »
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « __rtti_user »
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « istream::ios virtual table»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « __throw »
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « terminate(void)»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « istream::get(char *, int, char)»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « istream::getline(char *, int, char)»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « istrstream::istrstream(int, char const *, int)»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « istrstream::~istrstream(void)»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « istream::ignore(int, int)»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « ifstream::~ifstream(void)»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « istream::peek(void)»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « __builtin_vec_new »
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « __builtin_vec_delete »
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « fstreambase::fstreambase(int, char const *, int, int)»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « ifstream::ios virtual table»
/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « __builtin_delete »/usr/local/sesam/lib/libsgd.so: référence indéfinie vers « __builtin_new »
dont know how to fix it... it will compile on my mate's comp but not on mine

when i run
Quote ...
ldd prog
on my friends's, it will print one more line than on mine :
Quote ...
libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2 (0xb7bf3000)
tried to link that library on mine but didn't succed. Locating it will find :
Quote ...
/usr/lib/libstdc++-libc6.1-1.so.2
Maybe this is why my program wont compile on my computer...

I can provide more details if you need.

Hope you can help
Last edited by Spartan552; May 22nd, 2008 at 6:10 am.
Reputation Points: 10
Solved Threads: 0
Light Poster
Spartan552 is offline Offline
27 posts
since Jan 2008
May 22nd, 2008
0

Re: undefined reference

1. I wonder why things work without linking to /usr/local/sesam/lib/libssv.so if you need it.
And if links without it I wonder why you need it.
2. Compare the size/timestamp of your mate's lib and your lib (/usr/lib/libstdc++-libc6.1-1.so.2). I think comparing the symbol table would be an overkill if size/timestamp are same.
3. Can't really say much except that when you link with ssv, the symbols needed by it are not available so it gives errors ! But I think it's pretty obvious..

It does seem like the symbols you need might be there in stdc++. But you can confirm it once. So what you can do is:
- "ldd prog" on mate's comp
- then look for one of the symbols say "terminate(void)" in all .so files listed there. (donno what's teh command to list all symbols in a .so in gnu. In Sun workshop it's nm -C, so it goes like this: nm -C <xxx.so>| grep "terminate")
- Then find the same .so on your machine and check that it also contains the symbols, if it does link with it, if it doesn't it's a problem with your installation/version..

Lastly, check the documentation of your STL impl. Usually if you link to .so(s) specified there things should work.
Last edited by thekashyap; May 22nd, 2008 at 7:43 am.
Reputation Points: 254
Solved Threads: 74
Practically a Posting Shark
thekashyap is offline Offline
804 posts
since Feb 2007
May 29th, 2008
0

Re: undefined reference

fixed this installing a newer version of the library libstdc++

Download : libstdc++-2-libc6.1-1-2.9.0.so in /usr/lib then type :
Quote ...
ln -s libstdc++-2-libc6.1-1-2.9.0.so libstdc++-libc6.1-1.so.2
ldconfig
Thanks for ur help
Last edited by Spartan552; May 29th, 2008 at 6:33 am.
Reputation Points: 10
Solved Threads: 0
Light Poster
Spartan552 is offline Offline
27 posts
since Jan 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Algorithim
Next Thread in C++ Forum Timeline: Help with program...can't get array to accept a struct





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC