Re: Newbie: gcc can't link with math.h functions?


Subject: Re: Newbie: gcc can't link with math.h functions?
From: Benoit Nadeau (benad@mac.com)
Date: Sun Nov 04 2001 - 09:56:18 MST


>Hi - You need to explicitly link the math library. Try
>
>  gcc test.c -o test -lm

Well... I always though the math libs were linked by default...
(reading tons of man pages)

From "man gcc":
/lib/libc.a standard C library, see
                   intro(3)

From "man 3 intro":

(3M) These functions are contained in the arithmetic library libm.
       They are used by the f77(1) FORTRAN compiler by default, but
       not by the cc(1) C compiler, which needs the option -lm.

So, as I'll say to myself, RTFM ;-)

Thanks!

- Benad



This archive was generated by hypermail 2a24 : Sun Nov 04 2001 - 10:08:51 MST