I have take code from cppfaq 12.15 and trying to compile but getting error in linux with gcc version 4.8.4.
undefined reference to `vtable for
I am surprise as I do not have any virtual method. I have looked into following question but not able figure out issue.
c++ undefined reference to vtable
Undefined reference to 'vtable for xxx'
The code
#include<iostream>
#include<new>
#include<memory> using namespace std;
class Fred; typedef auto_ptr<Fred> FredPtr;
class Fred {
    public:
        static FredPtr create() throw(bad_alloc);
        static FredPtr create(int i) throw(bad_alloc);
        static FredPtr create(const Fred& x) throw(bad_alloc);
        virtual void goBowling();
    private:
        Fred(int i=10);
        Fred(const Fred& x);
        int i_;
    };
FredPtr Fred::create() throw (bad_alloc) {   return auto_ptr<Fred>(new Fred()); }
FredPtr Fred::create(int i) throw(bad_alloc) {
    return auto_ptr<Fred>(new Fred(i)); }
FredPtr Fred::create(const Fred& x) throw(bad_alloc) {
    return auto_ptr<Fred>(new Fred(x)); }
Fred::Fred(int i) {
    i_ = i;
    cout<<" This is simple constructor"<<endl; }
Fred::Fred(const Fred& x) {
    i_ = x.i_;
    cout<<" This is copy constrcutor"<<endl; }
void sample() {
    FredPtr p(Fred::create(5));
    p->goBowling(); }
int main() {
    sample();
    return 0; }
Error:
/tmp/cc6JnLMO.o: In function `Fred::Fred(int)':
cpp12_15.cpp:(.text+0x204): undefined reference to `vtable for Fred'
/tmp/cc6JnLMO.o: In function `Fred::Fred(Fred const&)':
cpp12_15.cpp:(.text+0x247): undefined reference to `vtable for Fred'
collect2: error: ld returned 1 exit status 
 
     
    