This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ERROR Undefined symbol basic_ostream


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.
-- 
View this message in context: http://www.nabble.com/ERROR-Undefined-symbol-basic_ostream-tf2793665.html#a7793854
Sent from the gcc - libstdc++ mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]