I am trying to compile code with the following structure under codeblocks:
class a : public cppcms::application (has virtual members) {
public:
a() : b_inst(this) {}
...
b b_inst;
}
class b {
public:
b(a* ptr) : a_ptr(ptr) {}
private:
a* a_ptr;
...
}
I am trying to put this together with codeblocks/g++ and get the following error message (at the linking stage):
undefined reference to `vtable for b (In function b: ...)
I tried pulling of the same thing with a reference, same result. I tried to change a::b_inst to a pointer and creating an instance of b with new in the constructor (codepart), same result. What is the right way to do this?
By the way, if I do not add the pointer passing on construction, the code works, so i think it is not resolved by the answer here