IN my VC++ code which was compiling fine earlier, I have added a function X() like this:
In the file BaseCollection.h
class Base
{
// code
virtual HRESULT X();
//code
};
IN the file DerivedCollection.h
class Derived:public Base
{
HRESULT X();
}
In the file DerivedCollection.cpp
HRESULT Derived::X
{
// definition of Derived here.
}
Have included the header files also properly in the .cpp file.
But still I don’t understand for what reason I am getting the link error:
error LNK2001: unresolved external symbol “public: virtual long
__thiscall Base::X()” (?X@Base@@UAEJI@Z)
I am really trying hard to fix this bug. Can anyone kindly help me in getting this issue resolved.
Thanks a lot in advance.
Have you implemented
X()inBase? You need to do that, or make it pure virtual:Also, your definition of
X()inDerivedlooks wrong. You probable need something like this: