Search code examples
mingwmingw-w64

Mingw64 version check


do you know how to check the version of mingw64, not the version of gcc/g++ but of mingw64 itself ?

I wondered if there's was any type of command or something to check the version, but there wasn't any.


Solution

  • For MinGW-w64 the following are defined:

    • __MINGW64_VERSION_MAJOR
    • __MINGW64_VERSION_MINOR
    • __MINGW64_VERSION_BUGFIX

    So the following C program will show the MinGW-w64 version.

    #include <stdio.h>
    
    int main ()
    {
      printf("MinGW-w64 version %i.%i.%i\n", __MINGW64_VERSION_MAJOR, __MINGW64_VERSION_MINOR, __MINGW64_VERSION_BUGFIX);
      return 0;
    }
    

    Note that this is specifically for MinGW-w64, for plain old MinGW it won't work. So you can use #ifdef __MINGW64_VERSION_MAJOR to detect of your using MinGW-w64 instead of MinGW.