GMP build issues
Duke Hound
dukethek9 at gmail.com
Sun Jun 22 05:19:50 CEST 2008
Sisyphus wrote:
>
> ----- 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
Thank you, thank you, thank you!
In codeblocks i had the libgmp.a library before the libgmpxx.a library.
Didn't think this order would be an issue, but gmpxx does wrap and link
to the gmp, so it is not unreasonable.
Thanks so much rob! BTW, I saw your name on a few other posts
throughout the internet...as i've been searching for the solution. I
really appreciate you taking the time to help us peons out ;)
Thanks,
Long live GNU!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gmplib.org/list-archives/gmp-discuss/attachments/20080621/439a65df/attachment.html
More information about the gmp-discuss
mailing list