Unsatisfied symbols for inline pure virtual overloads

John Love-Jensen eljay@adobe.com
Tue Aug 15 14:30:00 GMT 2006


Hi Tom,

Since Derived does not have a non-inlined virtual function, and since it's
virtual if it is called through a Base pointer or reference the compiler
needs to link to the actual function.

You probably need this switch...
-fkeep-inline-functions
...but my recommended solution is:  don't inline your virtual functions.  My
general guideline is:  never inline anything until you've done profiling to
show that it should be inlined for a needed performance gain.

Also, I strongly recommend you put in a virtual destructor in your Base
class.

Did you know that the g++ compiler generates the virtual function table in
the translation unit that has the first non-inlined virtual function
defined?  In the case where you don't have that, I suppose it emits a weak
linked or once-only linked virtual function table in all translation units.

HTH,
--Eljay



More information about the Gcc-help mailing list