Boost.Extension - simple inheritance sample - why we see no animals on linux?

前端 未结 2 1408
情歌与酒
情歌与酒 2020-12-21 13:04

So I try to port some Boost.Extension samples for linux.

The sample is described here. Here is my code port (classes with animals, animal prototype, main app, gener

2条回答
  •  清酒与你
    2020-12-21 13:55

    GCC on Linux by default has stricter linker optimization settings that MSVC on Windows. This leads to some factory patterns where classes register themselves as available appearing broken, simply because the linker optimizes away the classes. I didn't look at your code - but from the description it could be the problem.

    A related question, with an answer on how to avoid the unreferenced classes being dropped: How to force gcc to link unreferenced, static C++ objects from a library

提交回复
热议问题