https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- The difference will probably be that when including libstdc++'s <cstdio> this happens before mingw's <stdio.h> is included: // Make sure that POSIX printf/scanf functions are activated. As // libstdc++ depends on POSIX-definitions of those functions, we define // it unconditionally. #undef __USE_MINGW_ANSI_STDIO #define __USE_MINGW_ANSI_STDIO 1 That alters what <stdio.h> declares, due to this in <stdio.h> #if __USE_MINGW_ANSI_STDIO /* * User has expressed a preference for C99 conformance... */ That causes printf to be a wrapper around __mingw_vprintf, rather than calling the MSVCRT version: __mingw_ovr __attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1) int printf (const char *__format, ...) { register int __retval; __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format ); __retval = __mingw_vprintf( __format, __local_argv ); __builtin_va_end( __local_argv ); return __retval; } So the incorrect output seems to come from __mingw_vprintf.