Add -lm and place linked libraries after object on gcc cmdline.