This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: problem linking with GCC 3.0 -- undefined reference to `std::codecvt<char, char, __mbstate_t>::id
Dear Claudio,
Thank you very much for the tip. I tried what you suggested but I still have
the problem.
Here is the procedure that I followed:
1. Remove gcc, binutils, and glibc from the /usr/local tree.
2. Built and installed gcc 3.0 using the old gcc (2.95.2-12mdk)
and binutils (2.10.0.24-4mdk).
3. Tested C++ code. Code compiled but attempts to run
resulted in segmentation faults.
4. Rebuilt gcc 3.0 and binutils 2.11 using the new gcc
and the old binutils. An alternative would be to build gcc
this way and then build binutils separately with gcc 3.0
after recompiling gcc.
5. Tested C++ code. Code compiled but would not execute.
My fault since runtime linking referred to a non-existent linker.
6. Rebuilt glibc 2.2.3 with the new gcc and binutils.
7. Tested C++ code. Linking failed with the same error as before.
The error is
admin4pgdb.o: In function `std::basic_streambuf<char, std::char_traits<char>
>::overflow(int)':
/usr/local/include/g++-v3/bits/std_streambuf.h(.gnu.linkonce.t._ZSt9use_facetISt7codecvtIcc11__mbstate_tEERKT_RKSt6locale+0xc):
undefined reference to `std::codecvt<char, char, __mbstate_t>::id'
Using the same means to investigate the offending object file and C++ library
as in your message, I found
$ nm --demangle admin4pgdb.o | grep codecvt.*id
U std::codecvt<char, char, __mbstate_t>::id
and
$ nm --demangle libstdc++.a | grep codecvt.*id
00000008 B std::codecvt<char, char, mbstate_t>::id
U std::codecvt<char, char, mbstate_t>::id
U std::codecvt<char, char, mbstate_t>::id
Any suggestions? Thanks!
Mark