undefined reference to vtable [duplicate]

我的梦境 提交于 2019-11-28 00:30:19
SSinha

It is likely you got this error because you declared a virtual method in the Base class and did not define it, i.e no function body for the virtual function supplied in base class.

Try giving it some dummy body and compiling it might just work. I got this error just recently in a similar scenario that got fixed by providing a definition.

The error indicates you didn't define your base class's virtual function and compiler can not find this function in the base class'es Virtual Method Table. Each derived class's object will have this Virtual method table that containing address to method defined in derived class.

To resolve your error, you may also define this function as PURE virtual function, means no function body in base class, for example:

virtual int handle(struct per_thread_traffic_log * pttl)=0;

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!