On Tue, Mar 8, 2022 at 3:18 AM Stephen Kitt <st...@sk2.org> wrote:

>
> You can ask GCC itself:
>
> $ x86_64-w64-mingw32-gcc -E -include windows.h -
> <<<"__MINGW64_VERSION_MAJOR" | tail -n 1
> 9
>
>
Nice idea - works fine in a bash shell (cygwin and msys2) for me, but not
in a cmd shell.
With cmd.exe, there's no guarantee that 'tail' will be present.

In the end, I've just gone with a C file that prints out
__MINGW64_VERSION_STR (or prints "undef" if __MINGW64_VERSION_STR is not
defined).
And then the one-line command I've used is
CC -o rt.exe rt.c 1>nul 2>&1 && rt

It would have been nice to avoid compiling a C source file into an
executable ... but the alternatives were beginning to look next to
impossible (or worse ;-)

Thanks Gisle, Stephen, for presenting the other options.

Cheers,
Rob

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to