Gran número en C ++
Estoy tratando de colocar un gran número en una variable de C ++. El número es 600851475143
Intenté unsigned long long int pero recibí un error que decía que la constante era demasiado grande. Luego probé una biblioteca bigInt llamada BigInt ->http://mattmccutchen.net/bigint/
El problema es que no puedo compilar el código ya que recibo muchos errores con respecto a la lib.
referencia indefinida a `BigInteger :: BigInteger (int) '<- muchos de estos.
Aquí está mi código hasta ahora:
#include "string"
#include "iostream"
#include "bigint/NumberlikeArray.hh"
#include "bigint/BigUnsigned.hh"
#include "bigint/BigInteger.hh"
#include "bigint/BigIntegerAlgorithms.hh"
#include "bigint/BigUnsignedInABase.hh"
#include "bigint/BigIntegerUtils.hh"
using namespace std;
int main() {
//unsigned long int num = 13195;
//unsigned long long int num = 600851475143;
BigInteger num = 13195;
int divider = 2;
//num = 600851475143;
while (1) {
if ((num % divider) == 0) {
cout << divider << '\n';
num /= divider;
}
else
divider++;
if (num == 1)
break;
}
}
Si pongo un número más pequeño y no uso la biblioteca BigInt, este programa funciona bien. Cualquier ayuda será apreciada: D