cout cannot print __int128 - MinGW-w64

845 Views Asked by At

Previously I noticed that GCC has built-in support for 128-bit integer. now I'm trying it under MinGW but there are two problems with that:

  1. I can't print it using cout.
  2. I can't convert it to string neither by string's constructor nor by functions like to_string().

here is the code:

#include <iostream>

using namespace std;

int main() {
    __int128 a = 12;
    cout << a;
    
    return 0;
}
Use of overloaded operator '<<' is ambiguous (with operand types 'std::ostream' (aka 'basic_ostream<char>') and '__int128')

My guess is to overload << operator for cout... but I don't know how?!

Also why cout doesn't have support for __int128 when this is a built-in type?!

0

There are 0 best solutions below