Undefined symbols “vtable for …” and “typeinfo for…”?

If Obstacle is an abstract base class, then make sure you declare all its virtual methods “pure virtual”:

virtual void Method() = 0;

The = 0 tells the compiler that this method must be overridden by a derived class, and might not have its own implementation.

If the class contains any non-pure virtual functions, then the compiler will assume that they have an implementation somewhere, and its internal structures (vtable and typeinfo) might be generated in the same object file as one of those; if those functions are not implemented, then the internal structures will be missing and you will get these errors.

Leave a Comment