Skip to main content
gamedev.net
🔒 Locked

linker error : vtable

Started by JPulham 3 replies 550+ views
Original Post
JPulham
JPulham
I'm writing a game engine with a base calss called 'FVideoDriver'. When I inherit from that with 'FOpenGLDriver' I get the error: [linker error] undefined reference to 'vtable for Namespace::class'. this happens whenever I try to use inheritance... so whats the problem? I'm using DevCpp with MinGW. (if you need more code tell me)
Bregma
Bregma
GCC (the compiler used by MinGW) will emit the vtable (virtual function lookup table) into the object file corresponding to the translation unit containing the destructor of the object (got that?).

Try declaring a virtual non-inline destructor in your base class and make sure it's defined in a separate source file that gets included in your app. It can be pure virtual, as long as it's defined somewhere non-inline.
Stephen M. Webb
Professional Free Software Developer
JPulham
JPulham
Thanks...I fixed it but couldn't understand how :P

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.