Simple C++ Compile Error

Robert Evans bobsphysics at
Mon Aug 11 23:42:23 CEST 2008

In my first "hello world" type program, the one identical to that on page 75, g++ produces the following error:

bevans at revanslinux /home/bevans/gmp-4.2.3/bob> g++ -lgmpxx -lgmp
/home/bevans/gmp-4.2.3/include/gmpxx.h: In destructor ‘__gmp_alloc_cstring::~__gmp_alloc_cstring()’:
/home/bevans/gmp-4.2.3/include/gmpxx.h:1367: error: ‘mp_get_memory_functions’ was not declared in this scope

I see the declaration of mp_get_memory_functions in gmp.xx, so am not sure what is wrong.

#include </home/bevans/gmp-4.2.3/include/gmpxx.h>
#include <iostream>
using namespace std;
int main(void)
    mpz_class a,b,c;
    a = 1234;
    b = "-5678";
    c = a+b;
    cout << "sum is " << c << endl;
    cout << "absolute value is " << abs(c) << endl;
    return 0;

GMP version 4.2.3
Only configuration option was --prefix

bevans at revanslinux /home/bevans/gmp-4.2.3/bob> g++ --version
g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51)

bevans at revanslinux /home/bevans/gmp-4.2.3/bob> uname -a
Linux revanslinux 2.6.19-1.2895.fc6 #1 SMP Wed Jan 10 19:28:18 EST 2007 i686 GNU/Linux

bevans at revanslinux /home/bevans/gmp-4.2.3> ./config.guess
bevans at revanslinux /home/bevans/gmp-4.2.3> ./configfsf.guess

Thanks, Bob

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the gmp-bugs mailing list