public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17694] New: g++ fails to link libstdc++ when linking libraries only
@ 2004-09-27 15:35 psfales at lucent dot com
  2004-09-27 15:41 ` [Bug c++/17694] " psfales at lucent dot com
  2004-09-27 15:44 ` pcarlini at suse dot de
  0 siblings, 2 replies; 3+ messages in thread
From: psfales at lucent dot com @ 2004-09-27 15:35 UTC (permalink / raw)
  To: gcc-bugs

I'm not completely sure this is a bug, but it worked in 3.3.1 and broke some of
our code when we moved to 3.4.1

# Compiling a simple c++ program from the command line works:
##############################################################
$ cat tst.cpp
#include <fstream>
#include <iostream>

main( )
{
   using namespace std;
   cout << "hello world" << endl;
}
 

# But, if we first create a library, then link with that library, the link
# fails.   Internally, it seems that g++ is failing to link in libstdc++ in
# this case:
###########################################################################
$ g++ tst.cpp -o tst
$ ./tst
hello world
$ 
$ g++ tst.cpp -o tst
$ ./tst
hello world
$ g++ -c tst.cpp    
$ ar r libtst.a tst.o    
$ g++ -L. -ltst -otst                  
./libtst.a(tst.o)(.text+0xd): In function `std::__verify_grouping(char const*,
unsigned int, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::size() const'


# It works if we explicitly include -lstdc++, but that was not needed in 3.3.1
#######################################################################
$ g++ -L. -ltst -lstdc++ -o tst
$ ./tst 
hello world
$

-- 
           Summary: g++ fails to link libstdc++ when linking libraries only
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: psfales at lucent dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17694


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

* [Bug c++/17694] g++ fails to link libstdc++ when linking libraries only
  2004-09-27 15:35 [Bug c++/17694] New: g++ fails to link libstdc++ when linking libraries only psfales at lucent dot com
@ 2004-09-27 15:41 ` psfales at lucent dot com
  2004-09-27 15:44 ` pcarlini at suse dot de
  1 sibling, 0 replies; 3+ messages in thread
From: psfales at lucent dot com @ 2004-09-27 15:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From psfales at lucent dot com  2004-09-27 15:41 -------
Sorry, my cut/paste wasn't quite right in the original report.   To clarify,
this works:

$ g++ tst.cpp -o tst

But this does not:

$ g++ -c tst.cpp    
$ ar r libtst.a tst.o    
$ g++ -L. -ltst -otst

Is this a bug?




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17694


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

* [Bug c++/17694] g++ fails to link libstdc++ when linking libraries only
  2004-09-27 15:35 [Bug c++/17694] New: g++ fails to link libstdc++ when linking libraries only psfales at lucent dot com
  2004-09-27 15:41 ` [Bug c++/17694] " psfales at lucent dot com
@ 2004-09-27 15:44 ` pcarlini at suse dot de
  1 sibling, 0 replies; 3+ messages in thread
From: pcarlini at suse dot de @ 2004-09-27 15:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-09-27 15:44 -------


*** This bug has been marked as a duplicate of 17537 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17694


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

end of thread, other threads:[~2004-09-27 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-27 15:35 [Bug c++/17694] New: g++ fails to link libstdc++ when linking libraries only psfales at lucent dot com
2004-09-27 15:41 ` [Bug c++/17694] " psfales at lucent dot com
2004-09-27 15:44 ` pcarlini at suse dot de

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).