I am quite new to programming and even newer to linux (does that make sense?). A while back I started to program in C++ and found it quite easy on linux. I just used the command
gcc hello.cpp -o hello
And all was well. Now when I try and compile anything I get lots of strange errors. I tried to compile this program....
Code:
#include <iostream>
int main()
{
std::cout << "Hello world.";
return 0;
}
And got these errors...
Code:
gcc hello2.cpp -o hello2
/tmp/ccfO003J.o: In function `main':hello2.cpp:(.text+0x27): undefined reference to `std::cout'
:hello2.cpp:(.text+0x2c): 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/ccfO003J.o: In function `__tcf_0':hello2.cpp:(.text+0x46): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccfO003J.o: In function `__static_initialization_and_destruction_0(int, int)':hello2.cpp:(.text+0x6f): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccfO003J.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
Is there something wrong with my machine or my code?
Any help appreciated
Thanks
Ironfistchamp