fork download
  1. #include <gmp.h>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6. const char value[] = "96235339320723582731297999650619328611574614010999021848237120827540643111659533232015727929762536954203339783487664173696047326516635885455262198105225642482446692119316427901218236539841109025591679494504249230339260895382001896212435544491445991547084493259899920270469961432683116732424841364504250318567";
  7. mpz_t x;
  8. mpz_init_set_str (x, value, 10);
  9.  
  10. char* to_send = (char*) malloc(sizeof(char) * sizeof(value));
  11. size_t* count = (size_t*) malloc(sizeof(size_t));
  12. mpz_export ((void*)to_send, count, 1, sizeof(char), 1, 0, x);
  13.  
  14. mpz_import(x, *count, 1, sizeof(char), 1, 0, to_send);
  15.  
  16. char str[sizeof(value)];
  17. mpz_get_str(str, 10, x);
  18. std::cout << str;
  19. return 0;
  20.  
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/home/G2lO2c/ccJnIIfk.o: In function `main':
prog.cpp:(.text.startup+0x3e): undefined reference to `__gmpz_init_set_str'
prog.cpp:(.text.startup+0x7b): undefined reference to `__gmpz_export'
prog.cpp:(.text.startup+0x9e): undefined reference to `__gmpz_import'
prog.cpp:(.text.startup+0xb8): undefined reference to `__gmpz_get_str'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty