System :: problems with gcc1.dsl



well, the topic description pretty much said it all.
i downloaded, checked the md5sum and installed gcc1.dsl (which went really well). i wrote a short hello_world and tried to compile it. the computer thought for about 10 seconds and then complained. here is the program and the complaint, incase anybody's interested:

Quote

#include <iostream>
using namespace std;

int main()
{
cout << "hello world" << endl;
return 0;
}

Quote

/tmp/ccBMGhHB.o(.text+0x1b): In function `main':
: undefined reference to `std::cout'
/tmp/ccBMGhHB.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/ccBMGhHB.o(.text+0x28): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/tmp/ccBMGhHB.o(.text+0x30): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccBMGhHB.o(.text+0x59): In function `tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccBMGhHB.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status


i suppose these undefined reference things could mean, that the standard library isn't correctly installed. but it doesn't complain about my #include instruction.

does anyone know what's up?

yours

howie

howlingmadhowie, take a look at this previous g++ post.  I believe you need to compile c++ programs with g++ rathr than gcc.  You didn't mention what comand line you were using to compile your program, but try:

g++ -o hello hello.cpp

that was it, many thanks :)

now why didn't i find that page while searching the forum?...


original here.