Hi all,
I'm interested in using the GNU Multiple Precision library so I can work with big numbers however after a successful installation I can't run an example code.
My code is as follows:
But when I run it using the 'gcc -o test test.c -lgmp -lm' command as specified I get the following error:Code:#include <stdio.h> /* for printf */ #include </state/partition1/home/mcdonnellj/assignmentB/gmp-5.0.5/gmp.h> int main( int argc, char *argv[] ) { mpz_t a, b; /* working numbers */ if( argc < 3 ) { /* not enough words */ printf( "Please supply two numbers to add.\n" ); return 1; } mpz_init_set_str( a, argv[1], 10 ); /* Assume decimal integers */ mpz_init_set_str( b, argv[2], 10 ); /* Assume decimal integers */ mpz_add( a, a, b ); /* a=a+b */ printf( "%s + %s => %s\n", argv[1], argv[2], mpz_get_str ( NULL, 10, a ) ); }
/usr/bin/ld: cannot find -lgmp
Does anybody know where I'm going wrong?



LinkBack URL
About LinkBacks


