https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69386
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- OK I see the problem, this is a MinGW-w64 bug, but I can solve it in libstdc++. windows.h includes windef.h which includes minwindef.h which does: #ifdef __cplusplus extern "C" { #endif ... #include <winnt.h> and then winnt.h includes <stdlib.h> from inside the extern "C" block. We can add extern "C++" to the libstdc++ headers to ensure our overloads get the right language linkage even when included inside an extern "C" block.