Problem using math library

Tom Tran tom.tran@noaa.gov
Wed Dec 17 18:24:00 GMT 2003


Hi,
I have problem using function in math.h.  gcc gives undefined reference
Here is a sample of my tstpow.c program:

#include <math.h>

int main()
{
   double d;

   d = pow(2.0, 3.0);
  return 0;
}

I compiled the program with:
    gcc tstpow.c

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.

Please help.

Tom Tran
tom.tran@noaa.gov



More information about the Gcc-help mailing list