Recently ran across a C++ linker error that was new to me.
libfoo.so: undefined reference to `VTT for Foo'
libfoo.so: undefined reference to `vtable for Foo'
I recognized the error and fixed my problem, but I still have a nagging question: what exactly is a VTT?
Aside: For those interested, the problem occurs when you forget to define the first virtual function declared in a class. The vtable goes into the compilation unit of the class's first virtual function. If you forget to define that function, you get a linker error that it can't find the vtable rather than the much more developer-friendly can't find the function.
The page "Notes on Multiple Inheritance in GCC C++ Compiler v4.0.1" is offline now, and http://web.archive.org didn't archive it. So, I have found a copy of the text at tinydrblog which is archived at the web archive.
There is full text of the original Notes, published online as part of "Doctoral Programming Language Seminar: GCC Internals" (fall 2005) by graduate Morgan Deters "in the Distributed Object Computing Laboratory in the Computer Science department at Washington University in St Louis."
His (archived) homepage:
Morgan Deters webpages:
PART1:
VTT = Virtual table table.
See C++ Class Representations.
They are the virtual (function) table, and the virtual types table, which handles multiple inheritance.
cf:
http://www.codesourcery.com/archives/cxx-abi-dev/msg00077.html http://www.cse.wustl.edu/~mdeters/seminar/fall2005/mi.html
The virtual table table, abbreviated VTT, is a table of vtables used in construction where multiple-inheritance is involved.
More information here in this interesting article: Notes on Multiple Inheritance in GCC C++ Compiler v4.0.1
Morgan Deters webpages:
PART2:
Thanks, Morgan Deters!!
Virtual Table Table(VTT). It allows objects to be safely constructed/deconstructed when there is multiple inheritence.
for an explanation see: http://www.cse.wustl.edu/~mdeters/seminar/fall2005/mi.html