0

im having some trouble with compiling a c++ project, keep getting:

   undefined reference to 'typeinfo for FileModule'

FileModule is a base class with some classes inheriting it. FileModule itself is inheriting from a base class called Module, using its constructor. any ideas how to fix it?

some code:

    #ifndef FILE_MODULE
    #define FILE_MODULE
    #include "module.h"

    class FileModule: public Module
    {
public:
    FileModule(){}
    FileModule(int id): Module(id) {}
    void getFileModule() const { return; }
    //FileModule* create(int type);
    virtual ~FileModule(){}
    virtual string getValue()= 0;
    virtual void assign(string toAssign, int location = 0) = 0;
    };
Liron
  • 9
  • 1
  • 1
    Most likely, something else is also undefined and if you fix that, this problem will go away. Is this the only linker error you're getting? Typical compilers "attach" the vitable to something else that has to be created once to ensure that the vtable only gets created once. Forget to define that other thing and you get this error. Typically it's some virtual function in the class, often the first one. – David Schwartz Oct 10 '15 at 22:35
  • Is that the entire definition of `FileModule`? – aschepler Oct 10 '15 at 22:35

0 Answers0