public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* getting  undefined references using gcc3.4
@ 2005-05-20  4:25 Deepak Soi
  0 siblings, 0 replies; 2+ messages in thread
From: Deepak Soi @ 2005-05-20  4:25 UTC (permalink / raw)
  To: gcc-help

Hi,
      I am getting lot of undefined references using gcc3.4 as      

                 undefined reference to `std::basic_string<char, 
std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
                 cppmsg.o(.text+0x755): undefined reference to 
`std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)

Can you please let me know the reason of this problem.I shall be 
thankful.               
 My earlier problem of pasting two token together was solved.gcc2-9 
gives warning on pasting two invalid tokens whereas gcc3.4 gives error.

thanks
Deepak

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Getting undefined references using gcc3.4
@ 2005-10-10 15:09 Yves Monier
  0 siblings, 0 replies; 2+ messages in thread
From: Yves Monier @ 2005-10-10 15:09 UTC (permalink / raw)
  To: gcc-help

Hello,

I'm getting undefined references using gcc3.4 when linking a program against 
one of my shared libraries:
.../libxeldaCommon_sd.so: undefined reference to `std::basic_string<char, 
std::char_traits<char>, std::allocator<char> >::_M_check(unsigned int) 
const'
.../libxeldaCommon_sd.so: undefined reference to `std::basic_string<char, 
std::char_traits<char>, std::allocator<char> >::_Rep::_S_create(unsigned 
int, std::allocator<char> const&)'
.../libxeldaCommon_sd.so: undefined reference to `std::basic_string<char, 
std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
.../libxeldaCommon_sd.so: undefined reference to 
`std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'

While I have no errors when I build the same libraries and programs with gcc 
3.2 (same gcc 3.2 / gcc 3.4 command lines).

I guess these errors are related to template instantiations. If I'm not 
mistaken I have three options for dealing with them:

- do nothing (i.e. no particular compile & link options for templates): this 
is currently what I do. This works with gcc 3.2. I know this can lead with 
code duplication, but I can leave with that for the moment (size of 
libraries produced with gcc 3.2 remains correct)

- use -frepo option. I tried that, and had to do a strange two-steps link:
g++ -o /dev/null <object files> <linker options> > foo.log    (many errors 
but cause instantiations to be generated?)
then
g++ -shared -g -o <lib name> <object files> <linker options>    (library 
properly created)
Still, when I link the program against the produced library, I get the same 
undefined references...

- use -frepo and -fno-implicit-templates: not tried yet (would prefer no to 
write the explicit instantiations myself...)

Any suggestion?

I saw two messages referring to two of the symbols above, but without 
solution:
http://gcc.gnu.org/ml/gcc-help/2005-05/msg00269.html and 
http://gcc.gnu.org/ml/gcc-help/2005-05/msg00305.html

Many thanks for your help!

Best regards,

Yves 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-10 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-20  4:25 getting undefined references using gcc3.4 Deepak Soi
2005-10-10 15:09 Getting " Yves Monier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).