PDA

View Full Version : Boken Compiler?



Mars8082686
March 6th, 2007, 12:38 AM
Hi, I am trying to compile a basic C++ program and I am getting a funny error. I have compiled C++ programs on this machine before, but now it being weird. I think there is a problem with my linker. Here is my C++ code

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World!";
return 0;
}
and here is the error I'm getting


/usr/bin/ld: Undefined symbols:
std::ios_base::Init::Init()
std::ios_base::Init::~Init()
std::cout
std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
___gxx_personality_v0
collect2: ld returned 1 exit status


any ideas?

hod139
March 6th, 2007, 01:14 AM
make sure you are using g++ to compile C++ code, not gcc.

Wybiral
March 6th, 2007, 02:07 AM
Have you installed "build-essential"?

If not, type this in the command line:


sudo apt-get install build-essential


That tends to be a VERY VERY common problem so it's worth a shot.

Mars8082686
March 6th, 2007, 02:16 AM
make sure you are using g++ to compile C++ code, not gcc.

I now feel like a complete and absolute noob... V.V
I'm going to go cut my self