Problem using math library

Bharathi S
Wed Dec 17 18:32:00 GMT 2003

On Wed, 17 Dec 2003, Tom Tran wrote:

> gcc gave this error: undefined reference pow

> I tried other functions s.a. sqrt(), sin(), etc.  Same problem.
> Other header files (s.a. <stdio.h> <string.h> <stdlib.h> work fine.

Math library will not be linked by default. Link it by -lm option.

gcc myprg.c -lm

Bye :)
Bharathi S, IndLinuX Team,   (__)
DON Lab,    TeNeT Group,     oo )
IIT-Madras, Chennai-INDIA.   (_/\ 

Known is drop, Unknown is OCEAN.

More information about the Gcc-help mailing list