https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80963
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I think the error message is correct as the class has a linkage of hidden in the shared library. That is Archive in the shared library and in the main executable are considered two different classes. To fix this you need to have the visibility default attribute on the class Archive .