iostream error.



Hi All,

I am executing simple hello world program. But, getting compile time
errors.
What is the problem here?

prasad@D-T11673A:~/programs/c> cat bst.cpp
#include<iostream>

using namespace std;

int main ()
{
cout << "Hello World." ;
return 0 ;
}

prasad@D-T11673A:~/programs/c> gcc bst.cpp
/tmp/ccrmoRpD.o: In function `main':
bst.cpp:(.text+0x25): undefined reference to `std::cout'
bst.cpp:(.text+0x2a): undefined reference to `std::basic_ostream<char,
std::char_traits<char> >& std::operator<< <std::char_traits<char>
(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccrmoRpD.o: In function `__tcf_0':
bst.cpp:(.text+0x47): undefined reference to
`std::ios_base::Init::~Init()'
/tmp/ccrmoRpD.o: In function
`__static_initialization_and_destruction_0(int, int)':
bst.cpp:(.text+0x74): undefined reference to
`std::ios_base::Init::Init()'
/tmp/ccrmoRpD.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

prasad@D-T11673A:~/programs/c> echo $?
1

Thanks & regards,
Prasad

.



Relevant Pages

  • Re: ifstream on gcc 3.2 problem, simple question
    ... using namespace std; ... int main{ ... if i compile it with icc then it's comiles even with no warnings and remarks. ... /tmp/cczlKupx.o: undefined reference to ...
    (comp.lang.cpp)
  • Building DDD for MC68K (on Cygwin)
    ... In function `GLOBAL(int10_t, long double, char, ... PannedGE.o:PannedGE.C: undefined reference to ... `GLOBAL(int12_t, long double, char, short, int, double)': ... resolving _applicationShellWidgetClass by linking to ...
    (comp.arch.embedded)
  • Failure with php4 and libgd support
    ... /usr/local/lib/libfreetype.so.9: undefined reference to `memmove' ... /* We use char because int might match the return type of a gcc2 ... configure:34929: checking for gdImageEllipse in -lgd ...
    (freebsd-questions)
  • Re: Refernce C code Porting
    ... 58): undefined reference to `_fstat_r' ... syscall that does memory mapping). ... int open ... "mounts", where the core filesystem was in the namespace 'file', and devices ...
    (comp.compression)
  • problems linking with the static qt lib
    ... In function `bitBlt(QPaintDevice *, int, int, QPaintDevice const *, ... qpaintdevice_x11.o: undefined reference to ... qfont.o: undefined reference to `XftPatternGetInteger' ...
    (comp.os.linux.questions)