mini-gmp: error: no previous prototype for 'mpz_lucas_mod'

Niels Möller nisse at
Mon Dec 31 09:01:15 UTC 2018

Vincent Lefevre <vincent at> writes:

> I get the following error when compiling mini-gmp.c:
> mini-gmp.c:3486:1: error: no previous prototype for 'mpz_lucas_mod' [-Werror=missing-prototypes]
>  3486 | mpz_lucas_mod (mpz_t V, mpz_t Qk, long Q,
>       | ^~~~~~~~~~~~~
> Indeed, mini-gmp.c exports mpz_lucas_mod:
> int
> mpz_lucas_mod (mpz_t V, mpz_t Qk, long Q,
>                mp_bitcnt_t b0, const mpz_t n)
> {
> [...]
> }
> but it is not declared in mini-gmp.h.

Hi, a late reply on this issue. It seems the current workaround is to
have a check for __MIN_GMP_TESTING in mini-gmp.c, and a prototype in

A different way to do it is to add a wrapper in testutils.c (which
*includes* mini-gmp.c, in order to get access to internals), and a
prototype for that wrapper in testutils.h. Then nothing special is
needed in mini-gmp.c itself.


Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.

More information about the gmp-bugs mailing list