ERROR Undefined symbol basic_ostream

View: New views
4 Messages — Rating Filter:   Alert me  

ERROR Undefined symbol basic_ostream

by mavin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I can compile a hello world program.
$> cat hello.cc
#include <iostream>

int main(int argc, char *argv[])
{
  printf("Hello, world!\n");
  std::cout << "Hello, world!\n";
}

$> g++ -c hello.cc

$> ls -l hello.o
-rw-r--r-- 1 xxxxxxxx xxxxxxx 2528 11 Dec 12:23 hello.o

I can't link the hello world program.

$> g++ -o hello hello.o

throws me this error,

ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >& std::opera
tor<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status

I am using following gcc version,

gcc version 4.0.0

For everyones information, I do have libstdc++.a present in my system and I even tried building linking the library as,

$> g++ -o hello hello.o -L/usr/lib -lstdc++

but eventually it gives me the same error.

Help from anyone would be appreciated.

Re: ERROR Undefined symbol basic_ostream

by Paolo Carlini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

mavin wrote:

>gcc version 4.0.0
>  
>
Ick, you are talking about a *very* old release. If I remember
correctly, the issue you are reporting was reproducable at some point
but happened only together with specific binutils releases, then was
certainly fixed in later releases (of course, the system would be
totally unusable otherwise). I would suggest installing an up to date
set of tools, including gcc 4.1.x and binutils  2.17.x.

Paolo.

Re: ERROR Undefined symbol basic_ostream

by mavin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

u mean gcc 4.0.0 is *very* old version???

I am sorry but how do i see binutils version?? and where do I get the latest binutils?

I am on AIX5.3 box.

mavin

Paolo Carlini wrote:
mavin wrote:

>gcc version 4.0.0
>  
>
Ick, you are talking about a *very* old release. If I remember
correctly, the issue you are reporting was reproducable at some point
but happened only together with specific binutils releases, then was
certainly fixed in later releases (of course, the system would be
totally unusable otherwise). I would suggest installing an up to date
set of tools, including gcc 4.1.x and binutils  2.17.x.

Paolo.

Re: ERROR Undefined symbol basic_ostream

by Paolo Carlini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

mavin wrote:

>u mean gcc 4.0.0 is *very* old version???
>  
>
That definitely, moreover, in very general terms, the *.0 release is
always affected by some rather serious bugs.

>I am sorry but how do i see binutils version?? and where do I get the latest
>binutils?
>
>I am on AIX5.3 box.
>  
>
Ah, ok, then probably you are not using the GNU binutils tools at all.
Have a look to the platform-specific installation notes here:

    http://gcc.gnu.org/install/specific.html#x-ibm-aix

or try to ask on gcc-help. I'm afraid we can't help more on this list
(which actually is about libstdc++ development, not general help, or bug
reporting). The only thing I cann tell you for sure is that up to date
ibm-aix systems, running up to date gcc don't show the problem,
otherwise gcc would be unusable.

Paolo.

LightInTheBox - Buy quality products at wholesale price!