Undefined reference to vtable while implementing virtual functions
<p>I try to implement examples of "C++ An Introduction To Programming" by Jesse Liberty and Tim Keogh but on implementing pure virtual functions is compiling but not building. It is giving the error : undefined reference to 'vtable for circle' </p>

<p>I have tried substituting the variable <code>itsRadius</code> for a virtual function <code>GetItsRadius</code> to see if it would work but it started giving me the same errors in the switch statement but for <code>Rectangle</code> and <code>Square</code> and also the same error as before for <code>circle</code>.</p>

<p>Here is the code:</p>

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

using namespace std;

enum BOOL { FALSE, TRUE };

class Shape
{
    public:
        Shape(){}
        ~Shape(){}
        virtual long GetArea() = 0; // error
        virtual long GetPerim()= 0;
        virtual void Draw() = 0;
    private:
};

void Shape::Draw()
{
    cout &lt;&lt; "Abstract drawing mechanism!\n";
}

class Circle : public Shape
{
    public:
        Circle(int radius):itsRadius(radius){}
        ~Circle(){}
        long GetArea() { return 3 * itsRadius * itsRadius; }
        long GetPerim() { return 9 * itsRadius; }
        void Draw();
    private:
        int itsRadius;
        int itsCircumference;
};

class Rectangle : public Shape
{
    public:
        Rectangle(int len, int width):
        itsLength(len), itsWidth(width){}
        ~Rectangle(){}
        long GetArea() { return itsLength * itsWidth; }
        long GetPerim() { return 2*itsLength + 2*itsWidth; }
        virtual int GetLength() { itsLength; }
        virtual int GetWidth() { itsWidth; }
        void Draw();
    private:
        int itsWidth;
        int itsLength;
};

void Rectangle::Draw()
{
    for (int i = 0; i&lt;itsLength; i++)
    {
        for (int j = 0; j&lt;itsWidth; j++)
            cout &lt;&lt; "x ";

        cout &lt;&lt; "\n";
    }
    Shape::Draw();
}

class Square : public Rectangle
{
    public:
        Square(int len);
        Square(int len, int width);
        ~Square(){}
        long GetPerim() {return 4 * GetLength();}
};

Square::Square(int len):
    Rectangle(len,len)
{}

Square::Square(int len, int width):
    Rectangle(len,width)
{
    if (GetLength() != GetWidth())
        cout &lt;&lt; "Error, not a square... a Rectangle??\n";
}

void startof()
{
    int choice;
    BOOL fQuit = FALSE;
    Shape * sp;

    while (1)
    {
        cout &lt;&lt; "(1)Circle (2)Rectangle (3)Square (0)Quit: \n";
        cin &gt;&gt; choice;

        switch (choice)
        {
            case 1: sp = new Circle(5);
                break;
            case 2: sp = new Rectangle(4,6);
                break;
            case 3: sp = new Square (5);
                break;
            default: fQuit = TRUE;
                break;
        }
        if (fQuit)
            break;

        sp-&gt;Draw();
        cout &lt;&lt; "\n";
    }
}


int main()
{
    startof();
}
</code></pre>