First usage, not compiling

Drew Roberts atroberts at gmail.com
Tue Jan 31 17:50:26 CET 2006


Hi, new to the library.

Ive run the build etc now trying to use and i get the following errors
on compiling.

andrew-roberts-powerbook-g4-15:~ andrewroberts$ gcc gmpTest.c -lgmp -o gmpTest
gmpTest.c: In function 'main':
gmpTest.c:24: warning: passing argument 1 of '__gmpq_add' from
incompatible pointer type
gmpTest.c:24: warning: passing argument 2 of '__gmpq_add' from
incompatible pointer type
gmpTest.c:24: warning: passing argument 3 of '__gmpq_add' from
incompatible pointer type
/usr/bin/ld: can't locate file for: -lgmp
collect2: ld returned 1 exit status

from this code


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


int main(void){

mpz_t sum, sum2, sum3;

mpz_init(sum);
mpz_init(sum2);
mpz_init(sum3);


mpq_add(sum3, sum, sum2);

printf("%d", sum);

}

just a simple program to get to grips with it. I have the same problem
from removing the mpz_init...lines too.

Can anyone advise? im guessing ive missed something really obvious in
the manual so apologies in advance.

Cheers

Drew


More information about the gmp-discuss mailing list