math.h

Jakub Jelinek jakub@redhat.com
Mon Mar 22 09:03:00 GMT 2004


On Sun, Mar 21, 2004 at 05:07:18PM -0600, pstucklep wrote:
> Since there are no log functions defined in the standard glibc math.h 
> header, 

They are prototyped in math.h.

> how can I compile ansi C files requiring a call to log10 or log2?

log10 is an ISO C89 function, so you just need
#include <math.h>
and it will be prototyped there.  Of course you should not forget to link
with -lm.
log2 is an ISO C99 function, so you need to compile with
-std=c99, -std=gnu99, -D_ISOC99_SOURCE or -D_GNU_SOURCE,
#include <math.h> and link with -lm.
See
info libc "Feature Test Macros"
for details.

	Jakub



More information about the Libc-alpha mailing list