problem with example of mpn_gcd

Décio Luiz Gazzoni Filho decio at decpp.net
Sat Jul 29 17:33:36 CEST 2006


On Jul 29, 2006, at 1:50 AM, Jiang wf wrote:

> 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 'exit'
> agcd.c:20: error: syntax error before 'mp_size_an'
>
>
>
>
> so, please, anyone can give me some advise about this problem, thanks!

Well I can. Drop any pretenses of being a computer programmer and go  
be a manager or CEO somewhere. You don't have what it takes to be a  
programmer.

And whether you follow my advice or not, do not post to this mailing  
list anymore. Your email nearly made me sick to my stomach.

Décio


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://gmplib.org/list-archives/gmp-discuss/attachments/20060729/fb361553/attachment.bin 


More information about the gmp-discuss mailing list