1 |
If a class defines virtual methods outside that class, then g++ generates the vtable only in the object file that contains the outside-of-class definition of the virtual method that was declared first:
The vtable will be in test1.o, but not in test2.o
This is an optimisation g++ implements to avoid having to compile in-class-defined virtual methods that would get pulled in by the vtable.
The link error you describe suggests that the definition of a virtual method (str::f in the example above) is missing in your project.
|
Wednesday, May 22, 2013
Debug: undefined reference to 'vtable for XXXClass'
undefined reference to 'vtable for XXXClass'
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment