Hi all,
The strangest thing happen today. I was trying on some cpp after years of java programming and some c programming. First you make the (in)famous 'Hello World' program. But I can't seem to get it right. I think the code is okay but there is something missing in, I suspect, the global variables for my gcc(version 3.3.4 (Debian 1:3.3.4-11)). Can some one please explain this or me?
The code is as follows:
Code:
#include <iostream>
using namespace std;
int main()
{
cout << "hello world";
return 0;
}
The error I get when compiling:
Code:
harm@castle:~/prj/cpp$ gcc hello.cpp
/tmp/ccvGiPa0.o(.text+0x1b): In function `main':
: undefined reference to `std::cout'
/tmp/ccvGiPa0.o(.text+0x20): In function `main':
: 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/ccvGiPa0.o(.text+0x49): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccvGiPa0.o(.text+0x7a): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccvGiPa0.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
harm@castle:~/prj/cpp$
This junk utterly mystifies me. Please help me.
With kind regards,
Harm