

Compiling with Math Library
Q. I include "math.h" in a my C program but the gcc compiler doesn't
recognize some of the functions such as "pow".
A. Add the option "-lm" at compile time to resolve the problem. If
you include <math.h> in your program, gcc won't automatically link
the program with the math library and it requires this option.
Example:
gcc -lm code.c
[FAQ by Index] [FAQ
by Category]
|