Compile problem

Skeoch, Ronald Leaton Ronald.Skeoch at
Mon Aug 16 01:06:21 CEST 2010



I have been using the GMP library for about two weeks now... I have run into
a build problem that I have not been able to correct.  I believe that I have
the library installed correctly but I am feeling that if it everything was
where it should be then I wouldn't be having a build problem, so I am
looking for some help.



I am using:

-          Ubuntu 10.04 as O/S (VM guest)

-          Geany 0.19 as my IDE

o   (g++ --version) g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3


Geany has the following set in the build commands: 

Compile: g++ -Wall -c "%f" -lgmp -lgmpxx

Build: g++ -Wall -o "%e" "%f" -lgmp -lgmpxx


My .cc file has the following globally defined:

#include "/home/user/gmp-5.0.1/gmpxx.h" //gmp library

#include <iostream>

#include <fstream>

using namespace std;


My functions are using statements like:

mpz_class C_seed;

mpz_t Z_prime;


gmp_printf("Seed number is:  %Zd\n", C_seed.get_mpz_t());

-          This works without a problem

cout << "Seed number is:  " << C_seed.get_mpz_t() << "\n";

-          This causes a build problem, but the compile works fine.


gmp_printf("Prime number is: %Zd\n", Z_prime);

-          Again this works fine

cout << "Prime number is: " << Z_prime << "\n";

-          This causes the same issue as with the other cout statement above



Build problem:

g++ -Wall -o "blah2" "" -lgmp -lgmpxx (in directory: /home/user)

/usr/local/lib/libgmpxx.a(osdoprnti.o): In function
std::char_traits<char> >&, doprnt_params_t*, char*)': undefined reference to `__gmp_asprintf_final'

/usr/local/lib/libgmpxx.a(osfuns.o):(.rodata+0x4): undefined reference to

/usr/local/lib/libgmpxx.a(osfuns.o):(.rodata+0x8): undefined reference to

collect2: ld returned 1 exit status

Compilation failed.



Could someone point me in the right direction to resolve this build issue I
am having when I use cout?




-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6317 bytes
Desc: not available
URL: <>

More information about the gmp-discuss mailing list