Wher do you put the bit of code. Attached is two c programs
On 1/9/07, Matthew Gregan <[EMAIL PROTECTED]> wrote:
At 2007-01-09T09:21:48+1300, David Merrick wrote:
> Another small problem with C. My C compiler dosen't sqrt(expression).
> It gives "undefined reference to sqrt" error however it accept
> sqrt(9), Any suggestions?
You need to link against the math library, e.g.
% cc -o foo foo.c -lm
The reason it works when you pass a constant value is that the compiler is
optimizing the call to sqrt() away as a constant load of the value of
sqrt(9.0).
Cheers,
-mjg
--
Matthew Gregan |/
/| [EMAIL PROTECTED]
-- David Merrick [EMAIL PROTECTED] Ph 03 3590 343 Cell 027 3089 169
quadratic.c~~
Description: Binary data
testq.c~
Description: Binary data
