At 15:05 2000.06.20 +0530, Madhav wrote:
>#include <math.h>
[snipped C code]
>is giving an error "undefined reference to 'sqrt' ". Can anybody tell me
>what the problem may be?
Basically, if you need to #include <math.h>, also use "-lm"
when linking. This is true for unices in general (and perhaps
other systems), not only for GCC on Linux.
Do something like
cc -c -Wall -O foo.c
cc foo.o -lm -o foo
or, in one step,
cc -Wall -O foo.c -lm -o foo
The C FAQ is your friend
(http://www.eskimo.com/~scs/C-faq/top.html).
Andr� Majorel <[EMAIL PROTECTED]>
http://www.teaser.fr/~amajorel/