On Wed, Mar 01, 2000 at 12:22:09PM -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.
>
Ok. I think I've talked about why you are having your problems already.
I just wanted to add a few things about g++ in general. If you are doing
this for school, they are probably teaching you ANSI C++. gcc does not
follow the ANSI standard without you specifically telling it to. If you
want to make it be as careful as (say Metroworks CodeWarrior(which still
doesn't understand that MAIN RETURNS INT!), or Borlands compiler), you'll
need to compile with at least:
g++ -Wall -ansi -pedantic
Which will get gcc pretty darn close to ansi, and I also believe RedHat6.1
ships with EGCS 1.x.x . You may want to upgrade gcc to 2.95.x as c++ is
something that is being fairly actively worked on (to my knowledge).
>
> 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???
Oh, and on this, no. The errors that you are getting come from the linker.
Occassionaly you will have a program that won't link right because you forgot
a header that had a macro that turned some function call like
foo(int a, int b, void *c)
^bad example for c++, but works for c
into
__foo__P(__int32, char *)
base on what b is or somesuch... and you can't link.
However if you compile all code -Wall you will get warned (in C at least,
I very rarely use the c++ compiler any more.) about implicit declarations
of functions. But usally linker errors are caused by something besides headers.
Like declaring a static function in one object file and that same function
extern in another and trying to link the two..
have fun
greg
--
this is not here
-
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