Undefined reference to vtable

前端 未结 16 2439
死守一世寂寞
死守一世寂寞 2020-11-21 20:30

When building my C++ program, I\'m getting the error message

undefined reference to \'vtable...

What is the cause of this probl

16条回答
  •  耶瑟儿~
    2020-11-21 21:29

    The GCC FAQ has an entry on it:

    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.

    Therefore, you need to provide a definition for the virtual destructor:

    virtual ~CDasherModule()
    { };
    

提交回复
热议问题