Segfault with asio standalone when classes in separate files

后端 未结 3 455
死守一世寂寞
死守一世寂寞 2020-12-31 04:39

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

3条回答
  •  一生所求
    2020-12-31 05:18

    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.

提交回复
热议问题