is it just me?! (linker troubles)

llewelly@dbritsch.dsl.xmission.com llewelly@dbritsch.dsl.xmission.com
Wed Apr 26 03:44:00 GMT 2000


On Wed, 26 Apr 2000, Gerhard Wesp wrote:

> > Try `g++' (gcc does not link -lstdc++ by default, AFAIK).  If that
> > fails, try to add `-L/usr/local/lib' or whichever is your install
> > library path.
> 
>   that's the obvious, i've tried all conceivable combination of these
> already, to no avail...  btw, the docs say that gcc/g++ should find its
> libraries automagically.
> 

'gcc' will *not* link libstdc++ by default; if you used gcc to compile
  c++ code, you will get link errors if you use any standard library
  names. See http://gcc.gnu.org/onlinedocs/gcc_2.html#SEC5

'g++' will automaticaly link the libstdc++ it was built with.

You should also look over your install of gcc + libstdc++, and see if they
  are correctly installed.

Try compiling your example with 

  $g++ -v -fhonor-std hello.cc

  The -v will make gcc spit out lots of info about what libraries it is
    linking, what directories it searches for header files in, etc. -v
    will often reveal a broken install, if you have one.

  You might also try running 

    $nm --demangle libstdc++.a
    
    If none of the symbols start with 'std::', you do not want 
      -fhonor-std.

    



More information about the Libstdc++ mailing list