public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Yves Monier" <yves.monier@temis-group.com>
To: <gcc-help@gcc.gnu.org>
Subject: Getting undefined references using gcc3.4
Date: Mon, 10 Oct 2005 15:09:00 -0000	[thread overview]
Message-ID: <03ff01c5cdac$a09d2790$f001000a@Castor> (raw)

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 

             reply	other threads:[~2005-10-10 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-10 15:09 Yves Monier [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-05-20  4:25 getting " Deepak Soi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='03ff01c5cdac$a09d2790$f001000a@Castor' \
    --to=yves.monier@temis-group.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).