Using -D__USE_MINGW_ANSI_STDIO=1  instead of -posix  works with the i686-w64-mingw32-g++  cross-compiler.

No idea why, either the cross-compiler -posix is different from the straight compiler, or the -w64 compiler is different.