Nothing is wrong with the above C program. What is wrong is not including the math library “-lm” when you compile. It’s a linker option, “-llibrary”. See man cc or #cc in konqueror.
Here is the output
cc first.c -lm
/tmp/ccs6xrnu.o: In function main': first.c: (.text+0x3b): undefined reference to Cos’
collect2: ld returned 1 exit status
You could probably define ‘pi’ quite a bit closer too…
3.14159265
Good luck.
tanmaya wrote:
| thanks it worked… I had written ‘Cos’ instead of ‘cos’…)
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org