The below is as minimal of an example as I can get. It does need to be in separate files as that seems to be what causes the segmentation fault error.
I\'m using Min
From my POV, it is a gcc bug. If you use clang++
instead of g++.exe
, the crash dissappears even without fiddling with #include
's ordering. Passing all source files to g++
in single call also makes crash disappear. This leads me to think that there is something wrong with gcc's COFF object files emission, since clang uses linker from the same mingw distribution.
So, either use clang or apply workaround from @Wouter Huysentruit's answer.
Note that latest clang release (3.7.0) has another bug, not related with your problem, that makes linking fail. I had to use nightly snapshot, which is quite stable anyway.