trouble compiling gmp-chudnovsky.c

Michael Abshoff Michael.Abshoff at fsmath.mathematik.uni-dortmund.de
Tue May 2 13:55:01 CEST 2006


> Hello,
>
> Thanks for a great website!
>
> I am unable to compile gmp-chudnovsky.c on my Linux PC.  The gmp library
> compiled fine, but when I try to compile gmp-chudnovsky.c (renamed to
> pi.c) as follows:
>
> [lloyd at localhost demos]$ [lloyd at localhost demos]$ gcc pi.c -lgmp
>

Hello,

you need to link the "regular" math library, too. I.e.  add -lm to the gcc
options.

Cheers,

Michael

> I get the following output:
>
> /home/lloyd/tmp/ccGVTUBR.o: In function `my_sqrt_ui':
> pi.c:(.text+0x52): undefined reference to `sqrt'
> pi.c:(.text+0xdd): undefined reference to `sqrt'
> /home/lloyd/tmp/ccGVTUBR.o: In function `build_sieve':
> pi.c:(.text+0x1797): undefined reference to `sqrt'
> collect2: ld returned 1 exit status
>
> I can't figure out why the sqrt function seems hidden from the linker.
>
> I'd appreciate any help.
>
> Regards,
> Lloyd
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at swox.com
> https://gmplib.org/mailman/listinfo/gmp-discuss
>




More information about the gmp-discuss mailing list