I can't compile this program!
Jakub Ilski
kilski@wp.pl
Sat Feb 15 17:04:00 GMT 2003
Hi.
On Friday 14 February 2003 06:25, japan wrote:
> I want to ask some questions!
>
> I have an ANSI C program named test.c:
>
> /*test.c*/
> #include <stdio.h>
> #include <math.h>
> main()
> {
> printf("%f\n",sqrt(4));
> return 0;
> }
>
> I can't compile this code. I used command:
>
> gcc -o test test.c
>
> Please tell me why and how to compile that code!
>
> Thanks.
You have to tell linker to add 'libm[ath]' library.
try:
gcc -lm -o test test.c
More information about the Gcc-help
mailing list