problem with example of mpn_gcd

Jiang wf jwf830 at
Sat Jul 29 06:50:04 CEST 2006

hello, everyone,

I just want use mpn_gcd to make a program, that can calculate gcd of two big
integers, the following is my code named agcd.c:

#include <stdio.h>
#include <gmp.h>

    main (int argc, char **argv)
      mpz_t a, b, p;

      if (argc != 3)
        { printf ("Usage: %s <number> <number>\n", argv[0]); exit (1); }

      /* Initialize and assign a and b from base 10 strings in argv */
      mpz_init_set_str (a, argv[1], 10);
      mpz_init_set_str (b, argv[2], 10);
      /* Initialize p */
      mpz_init (p);

      /* compute the gcd of a and b*/
     mp_size_t mpn_gcd (mp_limb_t *p, mp_limb_t *a,
          mp_size_an, mp_limb_t *b, mp_size_t bn)

      /* Print p in base 10 */
      mpz_out_str (stdout, 10, p);
      fputc ('\n', stdout);

      /* Since we're about to exit, no need to clear out variables */
      exit (0);

and when compiled, got the following error:

agcd.c: In function 'main':
agcd.c:9: warning: incompatible implicit declaration of built-in function
agcd.c:20: error: syntax error before 'mp_size_an'

so, please, anyone can give me some advise about this problem, thanks!

weifeng Jiang
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the gmp-discuss mailing list