C++ code will not compile

Greg Davis khiloa at gmail.com
Sun Mar 5 18:47:30 CET 2006


Hi guys,

I got this code from some forums:

#include <iostream>
using namespace std;
#include <gmp.h>

int main()
{
mpz_t x;
unsigned int y=126976;
mpz_init(x);
mpz_set_ui(x,4294967296);
cout << "\nx: " <<x << endl;
cout << "\ny: " <<y << endl ;
mpz_pow_ui(x, x, y);
cout << "x^y is  " << x << endl;
mpz_clear(x);
}

but when I try to compile it I get:

bignum.cpp:11: error: integer constant is too large for "long" type

Can anyone help me figure out why it does this? It seems to compile fine
on his computer.

Thanks for any help.


More information about the gmp-discuss mailing list