I'm still having an issue with the bug from g++ 4.6.1 however the solution provided doesn't seem relevant to g++ 5.3.0. Is there any other workaround besides installing mingw-w64?
My build command is:
g++ main1.cpp main2.cpp -g -std=gnu++11 -o program.exe