[oclug] undefined reference to 'vtable
patsmith at pobox.com
Sun Jul 6 09:44:57 EDT 2003
Francis J. A. Pinteric wrote:
>>Bob Lockie wrote:
>>>Has anyone seen this linker error before?
> Anyway, the problem is C++ related and it's because not all the library
> files needed are being passed to the linker. I don't know the app you're
> trying to link, but there is a workaround you can try.
> I've seen some programmes fail to link if your makefile is trying to
> link using just `ld' in linking LyX. Change the link command to `g++',
> fixing some of the command syntax as required. That might work.
> Otherwise, I don't know off hand to fix it.
Also, from the gcc 3.3 FAQ:
> When building C++, the linker says my constructors, destructors or virtual
> tables are undefined, but I defined them
> The ISO C++ Standard specifies that all virtual methods of a class
> that are not pure-virtual must be defined, but does not require any
> diagnostic for violations of this rule [class.virtual]/8. Based on
> this assumption, GCC will only emit the implicitly defined
> constructors, the assignment operator, the destructor and the virtual
> table of a class in the translation unit that defines its first such
> non-inline method.
> Therefore, if you fail to define this particular method, the linker
> may complain about the lack of definitions for apparently unrelated
> symbols. Unfortunately, in order to improve this error message, it
> might be necessary to change the linker, and this can't always be
> The solution is to ensure that all virtual methods that are not pure
> are defined. Note that a destructor must be defined even if it is
> declared pure-virtual [class.dtor]/7.
More information about the OCLUG