From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10825 invoked by alias); 10 Oct 2005 15:09:48 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 10805 invoked by uid 22791); 10 Oct 2005 15:09:44 -0000 Received: from smtp-out.completel.net (HELO smtp-out.completel.net) (83.145.110.35) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 10 Oct 2005 15:09:44 +0000 Received: from Castor (unknown [213.30.140.18]) by smtp-out.completel.net (Postfix) with SMTP id C141F25C0CB for ; Mon, 10 Oct 2005 17:09:42 +0200 (CEST) Message-ID: <03ff01c5cdac$a09d2790$f001000a@Castor> From: "Yves Monier" To: Subject: Getting undefined references using gcc3.4 Date: Mon, 10 Oct 2005 15:09:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit X-SW-Source: 2005-10/txt/msg00047.txt.bz2 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, std::allocator >::_M_check(unsigned int) const' .../libxeldaCommon_sd.so: undefined reference to `std::basic_string, std::allocator >::_Rep::_S_create(unsigned int, std::allocator const&)' .../libxeldaCommon_sd.so: undefined reference to `std::basic_string, std::allocator >::_S_empty_rep_storage' .../libxeldaCommon_sd.so: undefined reference to `std::__default_alloc_template::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 > foo.log (many errors but cause instantiations to be generated?) then g++ -shared -g -o (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