[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unix gcc question



Did you link in the math libraries??

Robert J. Kent wrote:
> 
> alright -
> 
> this isn't linux specific, but i'm thinking there might be some unix
> knowledge bouncing around out there:
> 
> recently i've needed to compile some C programs which use exp, pow, and
> sqrt, which are part of the double-precision floating point math package.
> the code is about this simple:
> 
> #include <math.h>
> 
> main(){ double x=sqrt(16.7); }
> 
> and it barfs at link time because sqrt is an "undefined reference."  at
> first i though my libraries were istalled incorrectly, but then it happened
> on two seperate Sun machines as well.  is there something else really
> obvious that i need to do to use math?
> 
> _____________________________________________________________________________
> 
>                     sometimes wrong, but never in doubt...
> _____________________________________________________________________________
>     rob kent   |    k96rk01@kzoo.edu    |    http://cc.kzoo.edu/~k96rk01/

-- 
         Microsoft...How many times do you want to reboot today?