GMP build issues

Sisyphus sisyphus1 at optusnet.com.au
Sun Jun 22 04:49:05 CEST 2008


----- Original Message ----- 
From: "Duke Hound" <dukethek9 at gmail.com>
.
.
>
> Below is the output from trying to compile the test code within msys.
>
> $ g++ -o mytest.exe test.cpp -I/usr/local/include -L/usr/local/lib -lgmpxx
> C:/DOCUME~1/dan/LOCALS~1/Temp/cc37G8yA.o:test.cpp:(.text$_ZN10__gmp_exprIA1_12__mpz_structS1_ED1Ev[__gmp_expr<__mpz_struct
> [1], __mpz_struct [1]>::~__gmp_expr()]+0xd): undefined reference to
> `___gmpz_clear'
> C:/DOCUME~1/dan/LOCALS~1/Temp/cc37G8yA.o:test.cpp:(.text$_ZN10__gmp_exprIA1_12__pz_structS1_EaSEi[__gmp_expr<__mpz_struct
> [1], __mpz_struct [1]>::operator=(int)]+0x14): undefined reference to
> `___gmpz_set_si'
> C:/DOCUME~1/dan/LOCALS~1/Temp/cc37G8yA.o:test.cpp:(.text$_ZN10__gmp_exprIA1_12__mpz_structS1_EC1Ev[__gmp_expr<__mpz_struct
> [1], __mpz_struct [1]>::__gmp_expr()]+0xd): undefined reference to
> `___gmpz_init'
> C:/msys/1.0/local/lib/libgmpxx.a(osmpz.o):osmpz.cc:(.text+0x39):
> undefined reference to `___gmpz_get_str'
> C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0x65):
> undefined reference to `___gmp_allocate_func'
> C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0x9d):
> undefined reference to `___gmp_doprnt_integer'
> C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0xa9):
> undefined reference to `___gmp_asprintf_final'
> C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0xcd):
> undefined reference to `___gmp_free_func'
> C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0x125):
> undefined reference to `___gmp_free_func'
> C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0x164):
> undefined reference to `___gmp_free_func'
> C:/msys/1.0/local/lib/libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x4):
> undefined reference to `___gmp_asprintf_memory'
> C:/msys/1.0/local/lib/libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x8):
> undefined reference to `___gmp_asprintf_reps'
> collect2: ld returned 1 exit status
>

Yes, I get the same, though the app builds and runs perfectly if I build it 
with:

$ g++ -o mytest.exe 
test.cpp -I/usr/local/include -L/usr/local/lib -lgmpxx -lgmp

I don't do any cpp stuff, and I didn't think it should be necessary to link 
to libgmp.a as well as libgmpxx.a. (I guess I was wrong about that, too, but 
I really don't know.)

Cheers,
Rob 



More information about the gmp-discuss mailing list