James Colannino wrote:
> Hey everyone. I included the math.h header, proceeded
to use fmod(),
> then got the following error:
>
> /tmp/ccKQxpJi.o: In function `main':
> 04-03-calc.c:(.text+0x144): undefined reference to
`fmod'
> collect2: ld returned 1 exit status
>
> Does anybody know why it won't link? fmod() is a part
of the standard
> library.
No, fmod() is in libm, so you have to add -lm to the link
command.
As a general rule, anything which uses <math.h> has to
link against
libm.
--
Glynn Clements <glynn gclements.plus.com>
-
To unsubscribe from this list: send the line
"unsubscribe linux-c-programming" in
the body of a message to majordomo vger.kernel.org
More majordomo info at http://vge
r.kernel.org/majordomo-info.html
|