[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unix gcc question
>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?
What what your compile command, did you include the math library (-lm
or whatever it is). I had this problem once too.