If I include <stdlib.h>
or <stdio.h>
in a C program I don't have to link these when compiling but I do have to link to <math.h>
, using -lm
with gcc, for example:
gcc test.c -o test -lm
What is the reason for this? Why do I have to explicitly link the math library but not the other libraries?