LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-14-2005, 11:25 AM   #1
MasterOfTheWind
Member
 
Registered: Jul 2004
Distribution: Arch, Debian sid, Kubuntu, Slackware 11
Posts: 324

Rep: Reputation: 30
GNU doesn't seem to recognize libstdc++


Hi!

Just installed debian and got following problem: When trying to compile a simple program that uses some aspects of the std-lib (like vectors, strings and so on), I get following error messages on linking:

Code:
g++ -lm -O3 -ffast-math -Wall -I. main.o utils.o vector.o color.o matrix.o transform.o shape.o sphere.o -o iray
utils.o: In function `__gnu_cxx::__common_pool_base<__gnu_cxx::__pool, true>::_S_initialize()':
utils.cpp:(.gnu.linkonce.t._ZN9__gnu_cxx18__common_pool_baseINS_6__poolELb1EE13_S_initializeEv[__gnu_cxx::__common_pool_base<__gnu_cxx::__pool, true>::_S_initialize()]+0xd2): undefined reference to `__gnu_cxx::__pool<true>::_M_initialize()'
utils.o: In function `__gnu_cxx::__common_pool_base<__gnu_cxx::__pool, true>::_S_initialize_once()':
utils.cpp:(.gnu.linkonce.t._ZN9__gnu_cxx18__common_pool_baseINS_6__poolELb1EE18_S_initialize_onceEv[__gnu_cxx::__common_pool_base<__gnu_cxx::__pool, true>::_S_initialize_once()]+0x101): undefined reference to `__gnu_cxx::__pool<true>::_M_initialize()'
utils.o: In function `__gnu_cxx::__mt_alloc<NumValue, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::allocate(unsigned int, void const*)':
utils.cpp:(.gnu.linkonce.t._ZN9__gnu_cxx10__mt_allocI8NumValueNS_20__common_pool_policyINS_6__poolELb1EEEE8allocateEjPKv[__gnu_cxx::__mt_alloc<NumValue, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::allocate(unsigned int, void const*)]+0x2a1): undefined reference to `__gnu_cxx::__pool<true>::_M_initialize()'
color.o: In function `Color::getString()':
color.cpp:(.text+0x16d): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
color.cpp:(.text+0x175): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
color.o: In function `char* std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_construct<char*>(char*, char*, std::allocator<char> const&, std::forward_iterator_tag)':
color.cpp:(.gnu.linkonce.t._ZNSs12_S_constructIPcEES0_T_S1_RKSaIcESt20forward_iterator_tag+0x26): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_create(unsigned int, std::allocator<char> const&)'
color.cpp:(.gnu.linkonce.t._ZNSs12_S_constructIPcEES0_T_S1_RKSaIcESt20forward_iterator_tag+0x73): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
color.cpp:(.gnu.linkonce.t._ZNSs12_S_constructIPcEES0_T_S1_RKSaIcESt20forward_iterator_tag+0x79): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
color.o: In function `std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::seekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode)':
color.cpp:(.gnu.linkonce.t._ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE7seekoffElSt12_Ios_SeekdirSt13_Ios_Openmode+0x1a9): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::_M_out_cur_move(long)'
color.o: In function `std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::seekpos(std::fpos<__mbstate_t>, std::_Ios_Openmode)':
color.cpp:(.gnu.linkonce.t._ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE7seekposESt4fposI11__mbstate_tESt13_Ios_Openmode+0x128): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::_M_out_cur_move(long)'
color.o: In function `std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow(int)':
color.cpp:(.gnu.linkonce.t._ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE8overflowEi+0xd5): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::_M_out_cur_move(long)'
collect2: ld returned 1 exit status
make: *** [all] Error 1
I am using gcc version 4.02. "g++ -v -H" gives
Code:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2 (Debian 4.0.2-2)
Does anyone knows what's wrong? (the app compiled just fine on my old slackware 10.1)

Thanx
 
Old 10-15-2005, 08:49 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
As far as I can see you just forgot to tell the compiler
where to find the library... there's no -L statment.


Cheers,
Tink
 
Old 10-16-2005, 05:32 AM   #3
MasterOfTheWind
Member
 
Registered: Jul 2004
Distribution: Arch, Debian sid, Kubuntu, Slackware 11
Posts: 324

Original Poster
Rep: Reputation: 30
Well, I've tried that too. I've also tried to link the library directly, like
Code:
g++ /usr/lib/libstdc++-.so.5 main.o some_obj.o -o prog
And that of course didn't help either... so I'm rather clueless about what's really going on here
 
Old 10-16-2005, 12:16 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Code:
g++ -L/usr/lib -lstdc++ -lm -O3 -ffast-math -Wall -I. main.o utils.o vector.o color.o matrix.o transform.o shape.o sphere.o -o iray
should work...

Cheers,
Tink
 
Old 10-16-2005, 12:36 PM   #5
MasterOfTheWind
Member
 
Registered: Jul 2004
Distribution: Arch, Debian sid, Kubuntu, Slackware 11
Posts: 324

Original Poster
Rep: Reputation: 30
well, thanks for your suggestion :) I tried it, but I am still not able to compile my raytracer on debian sid. I'm getting a new kind of output now, though:

Code:
g++ -L/usr/lib -lm -lstdc++ -O3 -ffast-math -Wall -I. main.o utils.o vector.o color.o matrix.o transform.o shape.o sphere.o -o ivanray
utils.o: In function `__gnu_cxx::__common_pool_base<__gnu_cxx::__pool, true>::_S_initialize()':
utils.cpp:(.gnu.linkonce.t._ZN9__gnu_cxx18__common_pool_baseINS_6__poolELb1EE13_S_initializeEv[__gnu_cxx::__common_pool_base<__gnu_cxx::__pool, true>::_S_initialize()]+0xd2): undefined reference to `__gnu_cxx::__pool<true>::_M_initialize()'
utils.o: In function `__gnu_cxx::__common_pool_base<__gnu_cxx::__pool, true>::_S_initialize_once()':
utils.cpp:(.gnu.linkonce.t._ZN9__gnu_cxx18__common_pool_baseINS_6__poolELb1EE18_S_initialize_onceEv[__gnu_cxx::__common_pool_base<__gnu_cxx::__pool, true>::_S_initialize_once()]+0x101): undefined reference to `__gnu_cxx::__pool<true>::_M_initialize()'
utils.o: In function `__gnu_cxx::__mt_alloc<NumValue, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::allocate(unsigned int, void const*)':
utils.cpp:(.gnu.linkonce.t._ZN9__gnu_cxx10__mt_allocI8NumValueNS_20__common_pool_policyINS_6__poolELb1EEEE8allocateEjPKv[__gnu_cxx::__mt_alloc<NumValue, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::allocate(unsigned int, void const*)]+0x2a1): undefined reference to `__gnu_cxx::__pool<true>::_M_initialize()'
collect2: ld returned 1 exit status
make: *** [all] Error 1
EDIT:
But now I noticed something strange: sometimes apt-get complains about a missing version of GLIBCXX when installing some deb-files:
Code:
update-menus: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.6' not found (required by update-menus)
I haven't seen that one before... so where is this reference pointing to? what kind of library should I install or re-install? libc? I thought that everything was updated all right... Shouldn't have switched to Debian :( My Slackware was fine enough. What do they say? Don't fix what ain't broken?

Last edited by MasterOfTheWind; 10-16-2005 at 12:38 PM.
 
Old 10-16-2005, 12:51 PM   #6
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
Looks like you have a version conflict. libstdc++.so.5 is for gcc 3.3 or older, gcc 3.4 and 4.0 use libstdc++.so.6
 
Old 10-16-2005, 01:23 PM   #7
MasterOfTheWind
Member
 
Registered: Jul 2004
Distribution: Arch, Debian sid, Kubuntu, Slackware 11
Posts: 324

Original Poster
Rep: Reputation: 30
Oh yes, of course you are right! Compilation works with g++-3.3! Thanks a lot!

Though I still can't understand one thing: I have installed libstdc++ 5 and 6 while I also have g++ of versions 2.95, 3.3, 3.4 and 4.0. Don't ask how they ended up on my system, 'cause I can't recall installing them (does debian install them by default or something?? but c'mon... 4 versions??). Well, anyway, it's all right that g++ 2.95 and 2.33 choose libstdc++ 5 instead of libstdc++ 6, but why do g++ 3.4 and 4.0 automatically use that same version (libstdc++ 5)? Is there any way to make them aware that the libstdc++ 6 is also installed?
 
  


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
FC4 doesn't have libstdc++.so.5 but libstdc++.so.6 baosheng Fedora 14 04-06-2008 10:08 AM
GNU/Linux vs. GNU/OpenSolaris win32sux Linux - Software 5 11-27-2005 10:10 AM
mismatched rpm versions of libstdc++ and libstdc++-devel pcweirdo Linux - Software 8 11-29-2004 09:30 AM
GNU Pascal calls GNU C chris.hicks Programming 0 11-13-2003 11:18 AM
GNU C calls GNU Pascal? chris.hicks Programming 1 11-13-2003 08:48 AM


All times are GMT -5. The time now is 05:02 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration