gcc and math.h

Didier Casse didierbe at sps.nus.edu.sg
Mon Mar 22 01:28:24 UTC 2004


On 21/03/04, at 18:36 -0600, stucklenp <stucklenp at charter.net> wrote:

> Kind persons:
> 
> I routinely program using C and compile with gcc.  My problem is that I need
> some math log functions--ln, log10, and log2--and these functions are not
> included in math.h from what I can determine.  Can anyone suggest how I can
> get these functions?

All the functions that you're saying are included. Have a look here for
math.h fucntions:

http://www.opengroup.org/onlinepubs/007908799/xsh/math.h.html

Do a "man function" to find out more about the individual functions. e.g
"man log".

My guess is that you haven't linked your source code to the math
library. (-lm option)

i.e 

gcc -lm myfile.c -o myfile


With kind regards,

Didier.

---
PhD student.

Singapore Synchrotron Light Source (SSLS)
5 Research Link,
Singapore 117603

Email: didierbe at sps dot nus dot edu dot sg

Web: http://ssls.nus.edu.sg







More information about the fedora-list mailing list