title: How do I fix an undefined reference to vtable?
body: <p>I've seen a number of people with similar issues, but the solutions I've seen don't seem to fix my issue, so hopefully someone can see my issue and explain how to fix it or at least direct me to somewhere that can explain it.</p>
  
  <p>Here is my code (at least the part that is breaking):</p>
  
  <p>A.h</p>
  
  <pre><code>#ifndef A_H
  #define A_H
  
  enum myEnum {SOMEVALUE, OTHERVALUE};
  class C;
  
  class A
  {
      public:
          virtual enum myEnum foo(C* c) = 0;
  };
  
  #endif // A_H
  </code></pre>
  
  <p>B.h</p>
  
  <pre><code>#include "A.h"
  
  #ifndef B_H
  #define B_H
  
  class RuleConway : public A
  {
      public:
          enum myEnum foo(C* c);
  };
  
  #endif // B_H
  </code></pre>
  
  <p>B.cpp</p>
  
  <pre><code>#include "B.h"
  #include "C.h"
  
  enum myEnum foo(C* c)
  {
      // do things
      return SOMEVALUE;
  }
  </code></pre>
  
  <p>When I try to compile my project, I get this:</p>
  
  <blockquote>
    <p>undefined reference to `vtable for B'</p>
  </blockquote>
  
  <p>Does anyone know why I'm getting this error or how to fix it?</p>