Re: Where is C 'pow' function?
On 20/11/2000 at 11:44 -0700, Matt Miller wrote:
> The following C program:
>
> #include <math.h>
>
> int main ()
> {
> double p = pow (2, 3);
> return 0;
> }
>
> fails to link. ld issues the following complaint:
>
> undefined reference to `pow'
>
> Am I missing a library? How can I search libraries to see which
> library has a given function?
>
You have to link libm to your executable..
gcc -lm -o exec source.c
^^^
Regards, sena...
--
sena@decoy.ath.cx, http://decoy.ath.cx/~sena/
gpg fingerprint: F20B 12A8 A8F6 FD1F 9B1D BA62 C424 8E73 DD2E 47C8
Reply to: