title: Undefined Reference to 'vtable' for derived class and deconstructor of that
body: <p>I think something is wrong with the deconstructor  but have no idea. In fact, I don't understand the usage of deconstructor.
  The code is like this</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  class A
  {
  public:
  explicit A(int x);
  virtual ~A()=default;
  protected:
  int a;
  void function1(int X);
  };
  
  class B:public A
  {
  public:
  explicit B(int x);
  ~B();
  private:
  int c;
  };
  
  void A::function1(int X){
    std::cout &lt;&lt; "function1 " &lt;&lt; X&lt;&lt; endl;
  }
  
  A::A(int x):a(0)
  {
  std::cout &lt;&lt; "A " &lt;&lt; x+a&lt;&lt; endl;
  }
  
  B::B(int x):A(x),c(3)
  {
    std::cout &lt;&lt; "B " &lt;&lt; x+c&lt;&lt; endl;
  }
  
  int main()
  {
  B b1(1);
  return 0;
  }
  </code></pre>
  
  <p>It shows</p>
  
  <p>/home/qiuyilin/projects/inheritance/main.cpp:36: undefined reference to <code>vtable for B'
  CMakeFiles/inheritance.dir/main.cpp.o: In function</code>main':
  /home/qiuyilin/projects/inheritance/main.cpp:43: undefined reference to `B::~B()'
  collect2: error: ld returned 1 exit status</p>