When building my C++ program, I\'m getting the error message
undefined reference to \'vtable...
What is the cause of this probl
Undefined reference to vtable may occur due to the following situation also. Just try this:
Class A Contains:
virtual void functionA(parameters)=0;
virtual void functionB(parameters);
Class B Contains:
Class C Contains: Now you're writing a Class C in which you are going to derive it from Class A.
Now if you try to compile you will get Undefined reference to vtable for Class C as error.
Reason:
functionA
is defined as pure virtual and its definition is provided in Class B.
functionB
is defined as virtual (NOT PURE VIRTUAL) so it tries to find its definition in Class A itself but you provided its definition in Class B.
Solution:
virtual void functionB(parameters) =0;
(This works it is Tested)