__GMP_WITHIN_GMP error when building mpc-0.9 as dynamic library

Marc Glisse marc.glisse at inria.fr
Fri Feb 17 17:24:03 CET 2012

On Fri, 17 Feb 2012, niXman wrote:

> At attempt to build mpc-0.9 [1] as dynamic library (--enable-shared)
> for MinGW, I receive such errors:
>> configure:12385: i686-pc-mingw32-gcc -o conftest.exe  -O3 -pipe
>> -fomit-frame-pointer -momit-leaf-frame-pointer -I/mingw-libs/include
>> -D_FORTIFY_SOURCE=2 -g -std=c99 -pedantic -Wno-long-long -Wall -Wextra
>> -Werror -Wdeclaration-after-statement -Wundef -Wshadow


Any idea why mpc wants this flag? There is a reason why it is not even 
part of -Wextra...

>> -Wmissing-prototypes -Wno-unused-value -I/mingw-libs/include
>> -I/mingw-libs/include  -L/mingw-libs/lib -L/mingw-libs/lib  -pipe -s
>> -L/mingw-libs/lib conftest.c -lmpfr -lgmp  >&5
>> In file included from C:/msys/mingw-libs/include/mpfr.h:39:0,
>>                  from conftest.c:36:
>> C:/msys/mingw-libs/include/gmp.h:172:5: error: "__GMP_WITHIN_GMP" is
>> not defined [-Werror=undef]
>> C:/msys/mingw-libs/include/gmp.h:287:5: error: "__GMP_WITHIN_GMPXX" is
>> not defined [-Werror=undef]
> In a static build no errors.
> To solve this problem, I have to add:
>   for CFLAGS.
> Perhaps it should not be so?
> http://lists.gforge.inria.fr/pipermail/mpc-discuss/2012-February/001069.html

In the particular case of __GMP_WITHIN_GMP and __GMP_WITHIN_GMPXX, it 
seems that using #ifdef instead of #if would be fine.

Marc Glisse

More information about the gmp-bugs mailing list