I’m having an issue compiling my code when I’m using inheritance. I’ve tried most of everything but no luck compiling
I first have an abstract or ‘interface’ class
class ImyBase
{
public:
ImyBase();
ImyBase(....);
virtual ~ImyBase();
virtual void someFuncs() = 0;
....
};
Then I have a class that implements this class.
class myBase : public ImyBase
{
public:
myBase();
myBase(....);
virtual ~myBase();
void someFuncs();
....
};
Then I have a wrapper class.
class myWrap
{
public:
myWrap();
myWrap(....);
virtual ~myWrap();
void someFuncs();
....
};
Everything works good in the implementation at this point. But when I try to test the wrapper class, that’s where I get the error LNK2019: unresolved external symbol “public: __thiscall ImyBase::ImyBase(void)” (??0ImyBase@@QAE@XZ) referenced in function “public: __thiscall myBase::myBase(void)” (??0myBase@@QAE@XZ)
int main(int argc, char* argv)
{
myWrap wr;
}
Any help is appreciated! I know its gotta be a dum mistake somewhere…
You have no implementation for the base constructor. The options are defining the constructors in an implementation file or, if they’re empty, in the class definition itself:
or mark them as
defaultfor C++11: