Possible Duplicate:
Why do you have to link the math library in C?
When I write a program that uses functions from the math.h
library, why is it that I have to explicitly link to libm
even though they are part of the C standard library?
For instance, when I want to use the sin()
function I need to #include <math.h>
but I also need to pass -lm
to GCC. But for any other library from the standard library, I don't have to do that. Why the difference?