title: Undefined symbol: vtable
body: <p>So it's one of these compiler errors where I just cannot figure out the source of the problem.</p>
  
  <p>This is the class <code>LocalQualityMeasure</code>, header</p>
  
  <pre><code>#include &lt;unordered_set&gt;
  
  #include "../clustering/Clustering.h"
  #include "../graph/Graph.h"
  
  namespace Project {
  
  /**
   * Abstract base class for all local clustering quality measures.
   */
  class LocalQualityMeasure {
  
  
  public:
  
      LocalQualityMeasure();
  
      virtual ~LocalQualityMeasure();
  
      virtual double getQuality(std::unordered_set&lt;node&gt;&amp; C, Graph&amp; G) = 0;
  };
  
  } /* namespace Project */
  </code></pre>
  
  <p>and source:</p>
  
  <pre><code>#include "LocalQualityMeasure.h"
  
  namespace Project {
  
  LocalQualityMeasure::LocalQualityMeasure() {
  }
  
  LocalQualityMeasure::~LocalQualityMeasure() {
      // TODO Auto-generated destructor stub
  }
  
  
  } /* namespace Project */
  </code></pre>
  
  <p>And this is a derived class <code>Conductance</code>, header</p>
  
  <pre><code>#include &lt;algorithm&gt;
  
  #include "LocalQualityMeasure.h"
  
  namespace Project {
  
  class Conductance: public Project::LocalQualityMeasure {
  public:
      Conductance();
      virtual ~Conductance();
  
      virtual double getQuality(std::unordered_set&lt;node&gt;&amp; C, Graph&amp; G);
  };
  
  } /* namespace Project */
  </code></pre>
  
  <p>and source</p>
  
  <pre><code>#include "Conductance.h"
  
  namespace Project {
  
  Conductance::Conductance() : LocalQualityMeasure() {
  }
  
  Conductance::~Conductance() {
      // TODO Auto-generated destructor stub
  }
  
  double getQuality(std::unordered_set&lt;node&gt;&amp; C, Graph&amp; G) {
  
      double volume = 0;
      double boundary = 0;
      double all = 0;
  
      for (auto it = C.begin(); it != C.end(); ++it) {
          volume = volume + G.degree(*it);
          G.forNeighborsOf(*it, [&amp;](node v){
              if (C.find(v) == C.end()) boundary++;
          });
      }
  
      G.forNodes([&amp;](node v){
          all = all + G.degree(v);
      });
  
      if (volume == 0 || all-volume == 0)
          return 1;
      return boundary / std::min(volume, all-volume);
  }
  
  } /* namespace Project */
  </code></pre>
  
  <p>The linker complains about a missing vtable:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "Project::Conductance::getQuality(std::unordered_set&lt;long long, std::hash&lt;long long&gt;, std::equal_to&lt;long long&gt;, std::allocator&lt;long long&gt; &gt;&amp;, Project::Graph&amp;)", referenced from:
        vtable for Project::Conductance in Conductance.o
  ld: symbol(s) not found for architecture x86_64
  collect2: error: ld returned 1 exit status
  make: *** [Project-CommunityDetection-DPar] Error 1
  </code></pre>
  
  <p>I use GCC 4.7 with <code>--std=c++11</code>.</p>