http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51930
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-02-15 10:53:37 UTC --- (In reply to comment #8) > You could declare the struct before including that library's headers and set > its visibility with a pragma: > > #pragma GCC visibility push(default) > struct test; > #pragma GCC visibility pop Or just wrap the #include in these pragmas. If the instantiation needs to have default visibility, presumably the library has default visibility and so should its header.