Problems with gcc 2.95.3 / stdc++ 2.90.8

Philip Martin philip@codematters.co.uk
Wed Dec 19 05:27:00 GMT 2001


Neil Bird <neil@fnxweb.com> writes:

>    All compiles fine, and with a minor tweak (Cygwin have hardcoded
>    /usr/include/g++-3 where my install is /usr/local/include/g++-v3) I
>    can run g++.  Mostly.  I simple std::cout << "Hello world\n"
>    program gives me:
> 
> 
> /tmp/ccAz4QzY.o(.text+0x28):jibby.cc: undefined reference to `cout'
> /tmp/ccAz4QzY.o(.text+0x2d):jibby.cc: undefined reference to
> `basic_ostream<char, char_traits<char> > &
> operator<<<char_traits<char> >(basic_ostream<char, char_traits<char> >
> &, char const *)'
> 
> /tmp/ccAz4QzY.o(.text+0x62):jibby.cc: undefined reference to
> `ios_base::Init::Init(void)'
> 
> /tmp/ccAz4QzY.o(.text+0x7b):jibby.cc: undefined reference to
> `ios_base::Init::~Init(void)'
> 
> collect2: ld returned 1 exit status

I recall gcc 2.95 has a -fhonor-std/-fno-honor-std flag which controls
whether the compiler puts symbol std::xxx in the std or global
namespace. If you compile the library with -fhonor-std and compile
your code with -fno-honor-std I believe you will get this
error. Running nm -C on the library should tell you whether its
symbols are in the std namespace.

When I used 2.95 with v3 I usually edited gcc/gcc/cp/decl2.c to force
-fhonor-std as the default.

-- 
Philip



More information about the Libstdc++ mailing list