The errors indicate that you are writing in c++. Are you invoking the
compiler as g++? Do you have the right header files for c++? Are you using a
new enough version of gcc (you need 2.9.something, the one that was until
recently distributed as egcs) that it works right with C++?

Don't believe the documentation when it says that you can invoke it as gcc
and it will figure out the source language. Doesn't work reliably (for me,
doesn't work at all).

When you report errors with compiles, it's good practice to include the
command line you used to invoke the compiler. For a program as short as
"Hello World", including source would even have been reasonable.

At 12:22 PM 3/1/00 -0700, John Starkey wrote:
>I'm not sure if I am out of the scope of this list yet, but since I'm
>still new to Linux and gcc I thought I'd ask you guys.
>
>RedHat6.1 is the system.
>
>I'm trying to compile a small assignment for school using gcc. It won't
>compile so I stripped it down to "Hello World". I thought I'd compiled
>on this machine before but maybe not. Anyway.
>
>These are the errors:
>
>
>/tmp/cc2fWQbM.o: In function 'main':
>/tmp/cc2fWQbM.o(.text+0x4): undefined reference to 'endl(ostream &)'
>/tmp/cc2fWQbM.o(.text+0xe): undefined reference to 'cout'
>/tmp/cc2fWQbM.o(.text+0x13): undefined reference to
>'ostream::operator<<(char const *)'
>/tmp/cc2fWQbM.o(.text+0x1e): undefined reference to
>'ostream::operator<<(ostream &(*)(ostream &))'
>collect2: ld returned 1 exit status
>
>I also tried compiling something I've done before (on another machine)
>and it returned basically the same errors. So I am thinking it has to do
>with the install. So I tried installing glibc, glibc-devel, and
>glibc-profile. I think someone told me these are the C libraries. I also
>did a 'find iostream' and nothing came up. Math and iostream are the
>only includes I need in this one. I did find Math.h in
>/usr/i386-glibc20-linux/include
>
>Am I looking in the right direction???
>
>Thanks guys.
>
>John
>
>
>
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
>the body of a message to [EMAIL PROTECTED]
>Please read the FAQ at http://www.linux-learn.org/faqs
>
>
------------------------------------"Never tell me the odds!"---
Ray Olszewski                                        -- Han Solo
Palo Alto, CA                                    [EMAIL PROTECTED]        
----------------------------------------------------------------


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to