Why does this virtual destructor trigger an unresolved external?

前端 未结 7 1567
情书的邮戳
情书的邮戳 2021-02-19 03:43

Consider the following:

In X.h:

class X
{
    X();
    virtual ~X();
};

X.cpp:

#inclu         


        
7条回答
  •  [愿得一人]
    2021-02-19 04:14

    These aren't a complete program yet (or even a complete DLL). When you are getting the error, you are actually being helped, because X is unusable without a definition for ~X()

    All it means is that this specific compiler instance needed a definition for it in some cases. Even if it compiles, it doesn't do anything.

提交回复
热议问题