0

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?

Garbunkel
  • 1
  • 2
  • Have you provided an implementation of `CIOI::GetSensMsg()`? That's what the linker is looking for. – Greg Hewgill Dec 24 '13 at 00:25
  • 2
    We need to see the declaration of `CIOI`. Is `GetSensMsg` virtual? Is it pure virtual / abstract? – David Schwartz Dec 24 '13 at 00:25
  • 1
    Well, so far the only declaration of `CIOI` has been a forward declaration. You cannot reasonably expect a class to inherit something with no known interface. Please edit your question to show how `CIOI` is actually implemented or at the least something more concrete than a forward declaration. – Andon M. Coleman Dec 24 '13 at 03:21

0 Answers0