This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unsatisfied symbols for inline pure virtual overloads


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]