hello all ,
I am new to C programming and trying to learn by working some online tutorials.
I am working on a linux OS ( Ubuntu ) .
so the program is to calculate a table of sine values and I typed in the code pretty much the way it was show in the tutorial, the code is shown below:
Code:
/* Written: Winter 1995 */
#include < stdio.h>
#include < math.h>
void main()
{
int angle_degree;
double angle_radian, pi, value;
/* Print a header */
printf ("\nCompute a table of the sine function\n\n");
/* obtain pi once for all */
/* or just use pi = M_PI, where
M_PI is defined in math.h */
pi = 4.0*atan(1.0);
printf ( " Value of PI = %f \n\n", pi );
printf ( " angle Sine \n" );
angle_degree=0; /* initial angle value */
/* scan over angle */
while ( angle_degree <= 360 ) /* loop until angle_degree > 360 */
{
angle_radian = pi * angle_degree/180.0 ;
value = sin(angle_radian);
printf ( " %3d %f \n ", angle_degree, value );
angle_degree = angle_degree + 10; /* increment the loop index */
}
}
When I try to complile the program by typing
$ gcc program_name.c
I get the following error :
/tmp/cciKZE0g.o: In function `main':
sine.c:(.text+0x58): undefined reference to `sin'
collect2: ld returned 1 exit status
what does this mean ?? what should I do ? can any one help ?
thanks ,
raurava