https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113958
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- You can use visibility on the type even Like: ``` struct __attribute__ ((visibility("default"))) Foo1{ virtual void some_member() = 0; }; struct __attribute__ ((visibility("default"))) Foo : Foo1 { virtual void some_member(); }; ``` Which changes the visibility back to default for the whole class. This is documented here: https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Common-Type-Attributes.html#index-visibility-type-attribute You can also use the `pragma GCC visibility` too in the same way: https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Visibility-Pragmas.html#index-pragma_002c-visibility #pragma GCC visibility push(default) Though visibility on the struct applies to all methods too. Which I suspect you want really instead of marking each method as being default. The pragma push/pop makes it easier to mark the classes you want to be exported too. E.g. you can wrap including a header file with that to make sure those are exported.