我收到链接器错误,无法找出问题的根源。我希望你能帮帮我!创建类的对象时已经发生错误ClMyClass
。
两个错误:
Error 18 error LNK2019: unresolved external symbol "public: virtual __thiscall ClMyClass::~ClMyClass(void)" (??1ClMyClass@@UAE@XZ) referenced in function "void __cdecl Test1(void)" (?Test1@@YAXXZ)
Error 19 error LNK2019: unresolved external symbol "public: __thiscall ClMyClass::ClMyClass(void)" (??0ClMyClass@@QAE@XZ) referenced in function "void __cdecl Test1(void)" (?Test1@@YAXXZ)
//Test.cpp
#include "StdAfx.h"
#include "MyClass.hpp"
void Test1(){
ClMyClass oHandle;
}
//ClMyClass.hpp
class ClMyClass: public ClMyClassBase
{
public:
ClMyClass(void);
virtual ~ClMyClass(void);
//methods...
}
//ClMyClass.cpp
ClMyClass::ClMyClass(void):ClMyClassBase(),m_nCallbackError(ERROR_NOT_INITIALIZED), m_eState(eUnknown)
{
//initialize members
}
ClMyClass::~ClMyClass(void)
{
Unassign();
}
编辑:添加 .cpp 文件