On Thu, 13 Dec 2018 at 10:46, David Aldrich wrote: > > Our C++ application, that runs on Linux, links to dynamic libraries built > by us. When everything is built using gcc 7.3.0 with switch -std=c++98, the > libraries load ok. However, when I build everything without that switch > (i.e. with C++11) N.B. the default is -std=gnu++14 not 11. > dlopen() reports an undefined symbol: > > undefined symbol: _ZTIN8StarLibs7LinkSim2NR13StarOfdmGenNRE ( typeinfo for > StarLibs::LinkSim::NR::StarOfdmGenNR ) > > (The demangled symbol name is in brackets.) > > What could cause missing typeinfo, which is apparently for the class? It could be any number of things. Maybe the C++98 version of the application doesn't need that typeifo, so never notices it's not there. Or maybe it does need it, but when built as C++11 the class doesn't define its typeinfo. My guess is the latter. See https://gcc.gnu.org/wiki/VerboseDiagnostics#missing_vtable (the same logic applies to the typeinfo as to the vtable). If your class looks like this then its key function will be different in C++98 and C++11: class Foo { #if __cplusplus >= 201103: virtual void bar(); #endif virtual void baz(); }; If you don't define Foo::bar() somewhere then the typeinfo will never get emitted. > The class has methods that return const. Also the class's header file > #includes another class's header file and that included class contains some > static const members. That's completely irrelevant to typeinfo. > I tried declaring those members in a separate .cpp > file to allocate them storage (that recipe fixed a similar error in another > part of the code) but it did not fix this problem.