https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64275
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- The simplest way to solve this might be to replace the extern declarations in ios_init.cc such as: extern stdio_sync_filebuf<char> buf_cout_sync; with a pointer: extern stdio_sync_filebuf<char>* buf_cout_sync_p; then in globals_io.cc do: stdio_sync_filebuf<char>* buf_cout_sync_p = reintepret_cast<stdio_sync_filebuf<char>*>(buf_cout_sync); That way we have an explicit cast rather than just relying on the linker finding the symbol.