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??'

Recommended Answers

All 5 Replies

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;
}

oh i see..can you give me a link to realy good C tutorial for n00bs

Look at the sticky at the top of the forums "Starting C" which will be enough to get you strted with.

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.