This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Unsatisfied symbols for inline pure virtual overloads
- From: John Love-Jensen <eljay at adobe dot com>
- To: Thomas Matelich <matelich at gmail dot com>, MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Tue, 15 Aug 2006 06:36:24 -0500
- Subject: 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