The math routines are kept in an external library. If you use any functions included in math.h, then you need to tell gcc to explicitly use that external library.
For example, if your program was named: my_prog.c
Compile it with: gcc -o my_prog -lm my_prog.c
The math library is named libm. You tell gcc to use it with the -lm (lowercase L).