Attempting to compile & link code which includes the following under Microsoft Visual C++ v2010 yields an unresolved external:
ClassOne.h
class CIOI;
class CClassOne
{
public:
CIOI *m_pInterface1;
ClassOne.cpp:
void ClassOne::StartProcessing()
{
m_pInterface1->Start();
}
void ClassOne::GetSnsMsg ()
{
m_pInterface1->GetSensMsg();
}
ClassTwo.h:
class ClassTwo : public CIOI
{
public:
//...
virtual void Start();
virtual void GetSensMsg();
ClassTwo.cpp:
void ClassTwo::Start()
{
Startup();
}
//...
void ClassTwo::GetSensMsg ()
{
int dummy = 5;
// ...
}
I get the following during link: EventProc.lib(CIOI.obj) : error LNK2001: unresolved external symbol "public virtual void __thiscall CIOI:GetSensMsg(void)" (?GetSensMsg@CIOI@@UAEXXZ)
I included the "Start" function in this code segment since it seems to have the same scope as the GetSensMsg function, yet the code compiles & links fine for this. I appreciate any input you can offer as to what may be causing the unresolved external message. Thanks!!
UPDATE: Here's the implementation of CIOI: IOI.h:
class ClassOne;
class CIOI
{
CMessage entityMsg;
protected:
CInterfaceData *m_pDEs;
U16BIT *baseAddr;
RDISPMSG emitterData;
void ProcessEmitter(int first_half, int second_half);
public:
CIOI (CClassOne *pEM);
virtual ~CIOI();
virtual BOOL Initialize() = 0;
virtual void Start() = 0;
virtual void ProcessData(unsigned short msg_type = 0) = 0;
virtual void SendMessage(int MsgNum, WORD parm1 = 0, int msgNum2 = NoMsg, short msg1to2DelayCycles = 0) = 0;
};
Looks like I might be missing the declaration of GetSensMsg() from the CIOI class?