Error: undefined reference to cos
Jnanesh
jnanesh@vsnl.net
Sat Apr 5 06:18:00 GMT 2003
I am using gcc 3.2 on Red Hat Linux 8.0
When I compiled the C program given below using the command: cc test.c
#include <stdio.h>
#include <math.h>
#define pi 3.1415
int main()
{
double a;
a=sin(pi/2);
printf("a = %lf",a);
return(0);
}
It gives errors as given below
In function `main':
/tmp/ccBFnFNj.o(.text+0x1e): undefined reference to `sin'
collect2: ld returned 1 exit status
Please help me out to see through this problem
More information about the Gcc
mailing list