This is the compile line. If you're not using an ide, then you type in # gcc -o quadratic quadratic.c -lm
to compile it, linking in the math library to resolve any necessary references. To run it, ./quadratic Steve On Tue, 09 Jan 2007 11:01:04 +1300 David Merrick <[EMAIL PROTECTED]> wrote: > 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 >
