0

I always get the below error message :

error: undefined reference to 'vtable for a'

when I try to do a *ker = (a *)create_a_dll();

how to fix this problem ??

here are my definitions.

class base {...};

class a : public base {...};

extern "C" 
{
    base *create_a_dll()
    {
        return new a();
    }
}


class b : public base {...};

extern "C" 
{
    base *create_b_dll()
    {
        return new b();
    }
}

any information would be appreciated !!!!

thanks

Kiroxas
  • 891
  • 10
  • 24
  • Strange pointer type C-style casting here `a *ker = (a *)create_a_dll();` is a less strange thing in that line of code. But what if u use 'return new a;' without operator() bracers? – vard May 07 '14 at 10:42
  • What is in the `...`for class `a`? – Drax May 07 '14 at 15:58
  • to vard, well, I fix the problem... just my mistake...the error not complain the create_a_dll...but the next line I try to use a->do_something(), and the do_something I didn't add virtual modifier in the header file. to Drax, the ... just means do something. thanks ur information – user3610309 May 08 '14 at 08:54

0 Answers0