i ve got this

#include <stdio.h>
#include <math.h>
void main()
{
int    angle_degree;
double angle_radian, pi, value;

printf ("\nCompute a table of the sine function\n\n");

pi = 4.0*atan(1.0);
printf ( " Value of PI = %f \n\n", pi );
printf ( " angle     Sine \n" );
angle_degree=0;
while (  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;
}
}

and this when trying to compile

an@jan-desktop:~$ gcc new.c
new.c: In function ‘main’:
new.c:5: warning: return type of ‘main’ is not ‘int’
/tmp/ccIEsaAh.o: In function `main':new.c[IMG]http://www.linuxforums.org/forum/images/smilies/icon_sad.gif[/IMG].text+0x7[IMG]http://www.linuxforums.org/forum/images/smilies/icon_cool.gif[/IMG]: undefined reference to `sin'
collect2: ld returned 1 exit status
jan@jan-desktop:~$

what to do??'

Edited 3 Years Ago by happygeek: fixed formatting

main() always returns an int, never void. There are still a lot of bad examples on the net that show void main() but they are obsolete and wrong.

int main()
{
   // your code here


   return 0;
}

is possible to make .exe files with gcc (for win)

Yes it's posible with cygwin. Did you fix the sin problem? Try to add when U compile -lm. gcc example.c -o example -Wall -lm -W -pedantic -ansi

This article has been dead for over six months. Start a new discussion instead.