Why does this virtual destructor trigger an unresolved external?
问题 Consider the following: In X.h: class X { X(); virtual ~X(); }; X.cpp: #include "X.h" X::X() {} Try to build this (I'm using a .dll target to avoid an error on the missing main, and I'm using Visual Studio 2010): Error 1 error LNK2001: unresolved external symbol "private: virtual __thiscall X::~X(void)" (??1X@@EAE@XZ) Small modifications result in a successful build, however: X.h: class X { inline X(); // Now inlined, and everything builds virtual ~X(); }; or X.h: class X { X(); ~X(); // No