Add -lm to the command when calling gcc:
gcc -Wall -D_GNU_SOURCE blah.c -o blah -lm
This will allow the linker to link to the math library. Including math.h will tell the compiler that mathematical functions such as sqrt () exist, but they are defined in a separate library, which the linker must pack with your executable.
As FreeMemory notes, the library is called libm.a. On Unix-like systems, the rule for naming libraries is lib [blah] .a. Then, if you want to link them to your executable, you use -l [blah].
source share