10

I'm trying to compile a c program under mingw gcc. This program is using an __uint128_t integer. When I try to compile it under the standard ubuntu gcc on the same 64-bit machine, it perfectly works. But then, when I try to compile it for windows under mingw, it simply doesn't even recognize the __uint128_t keyword. What does this mean? There aren't 128 bit integers under mingw? If not, is there any programming language for windows which has native (and FAST) 128 bit integers?

phoxis
  • 60,131
  • 14
  • 81
  • 117
Matteo Monti
  • 8,362
  • 19
  • 68
  • 114

3 Answers3

7

You need

  • a relatively recent version of gcc
  • a version compiled with native 64 bit integer support

__int128_t is then emulated by using pairs of int64_t in the same way as 64bit integers are emulated with 32bit if they are not available on 32bit compiles

Jens Gustedt
  • 76,821
  • 6
  • 102
  • 177
6

I was able to get the same problem using Code::Blocks and the default mingw install (which is IA32 btw), however, when I installed TDM-MinGW64, it compiled fine (after adding the x64 compiler to C::B). So make sure your mingw build is targeting x64 (with -m64) and it is an x64 build of mingw, as __uint128_t is an optional x64 ABI extension.

whatever windows IDE you are using won't pick up __int128_t as a keyword though, as its a special GCC extension (as mentioned).

Necrolis
  • 25,836
  • 3
  • 63
  • 101
1

But then, when I try to compile it for windows under mingw, it simply doesn't even recognize the __uint128_t keyword. What does this mean? There aren't 128 bit integers under mingw?

Perform gcc -dM -E - < /dev/null | grep INT128. If it output the macro #define __SIZEOF_INT128__ 16, then __uint128_t is available. If it does not output the macro or its less than 16, then __uint128_t is not available.

Also see 128-bit integer - nonsensical documentation? on the GCC users mailing list.

jww
  • 97,681
  • 90
  • 411
  • 885