returning static member for virtual function, missing vtable for abstract class
<p>Newcomer in cpp here, be advised, possibly dumbness ahead. </p>

<p>I was trying to return a static property when implementing a virtual function. This issue a linker error saying that the function wasn't implemented. I'm lost with this issue.</p>

<p>I was able to reproduce the error with the following stripped down code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;map&gt;

class Abstract1 {
public:
    virtual char* getFoo();
};

class Base: public Abstract1 {
public:
    char* getFoo() {
        return Base::mapper[1];
    }
    static std::map&lt;int,char*&gt; mapper;
};

std::map&lt;int, char*&gt; Base::mapper;
int main(int argc, const char * argv[]) {
    Base::mapper[0] = "Hello!\n";
    Base::mapper[1] = "Goodbye!\n";
    Base* hello = new Base();
    // insert code here...
    std::cout &lt;&lt; hello-&gt;getFoo() &lt;&lt; "\n";
    return 0;
}
</code></pre>

<p>Yielding the following linker error:</p>

<pre><code>Undefined symbols for architecture x86_64:
  "typeinfo for Abstract1", referenced from:
      typeinfo for Base in main.o
  "vtable for Abstract1", referenced from:
      Abstract1::Abstract1() in main.o
</code></pre>