1

I am using visual studio 2013 and getting this error.

LNK2019: unresolved external symbol "public: static class CAIUInterface * __cdecl :GetInstance(void)"
(?GetInstance@CAIUInterface@@SAPAV1@XZ) referenced in function "public: int call CAppAIUInterface::CloseApp(void)" (?CloseApp@CAppAIUInterface@@QAEHXZ) D:\15008_CPDS\CPDS\AppAIUInterface.obj CPDS

CAIUInterface is a singleton class.

 // below is CAIUInterface.h
#include "std429.h"
#include <functional>

using namespace std;

class CAppAIUInterface; 
class CAIUInterface
{
private:
    static bool m_bInstanceFlag;                    
    static CAIUInterface *m_objAIU;                     

protected:
    CAIUInterface();

public:
    //Destructor
    ~CAIUInterface();
    static CAIUInterface* GetInstance();
    int Close();
};

// CAIUInterface.cpp file

#include <windows.h>
#include "AIUInterface.h"
using namespace std::placeholders;

bool CAIUInterface::m_bInstanceFlag = false;    
CAIUInterface* CAIUInterface::m_objAIU = NULL;
CAIUInterface* CAIUInterface::GetInstance()
{
    if (!m_bInstanceFlag)
    {
        m_objAIU = new CAIUInterface();
        m_bInstanceFlag = true;
    }
    return m_objAIU;
}


// APPAIUInterface.h 
#include "Transmitter.h"
class CAppAIUInterface
{
private:
    CTransmitter            m_objTrans;
public:
    CAppAIUInterface();
    ~CAppAIUInterface();
    int CloseApp();
};

// APPAIUInterface.cpp 
int CAppAIUInterface::CloseApp()
{
    unsigned int siResult = 0;
    siResult = CAIUInterface::GetInstance()->Close();
    if (siResult != CPDS_SUCCESS)
        return ERR_APP_AIU_CLOSE;
    return CPDS_SUCCESS;
}

0 Answers0