我在 Visual Studio 中有一个解决方案,它有 2 个项目,即 PAL_TEST 和 Unit_Test。
我在 PAL_TEST 中有一堂课,CPALResponse.h
#include "CFW_Stl.h"
class CPALResponse
{
public:
void SetCommandSucceeded(bool bCommandSucceeded = false);
bool GetCommandSucceeded();
void SetCommandType(int nCommandType);
int GetCommandType();
private:
bool m_bCommadSucceeded;
int m_nCommandType;
};
PAL_TEST CPALResponse.cpp 中的另一个文件
#include "stdafx.h"
#include "CFW_CPALResponse.h"
void CPALResponse::SetCommandSucceeded(bool bCommandSucceeded)
{
m_bCommadSucceeded = bCommandSucceeded;
}
bool CPALResponse::GetCommandSucceeded()
{
return m_bCommadSucceeded;
}
void CPALResponse::SetCommandType(int nCommandType)
{
m_nCommandType = nCommandType;
}
int CPALResponse::GetCommandType()
{
return m_nCommandType;
}
Unit_Test中有一个文件Unit_Test.cpp,
#include "stdafx.h"
#include "../PAL_TEST/CFW_CPALResponse.h"
int _tmain(int argc, _TCHAR* argv[])
{
CPALResponse a;
a.SetCommandSucceeded(true);
return 0;
}
当我构建 Unit_Test 项目时,它显示给我
1>------ Build started: Project: Unit_Test, Configuration: Debug Win32 ------
1>Linking...
1>Unit_Test.obj : error LNK2019: unresolved external symbol "public: void __thiscall CPALResponse::SetCommandSucceeded(bool)" (?SetCommandSucceeded@CPALResponse@@QAEX_N@Z) referenced in function _wmain
1>C:\Users\anubhav.a\Documents\Visual Studio 2008\Projects\PAL_TEST\Debug\Unit_Test.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\anubhav.a\Documents\Visual Studio 2008\Projects\PAL_TEST\Unit_Test\Debug\BuildLog.htm"
1>Unit_Test - 2 error(s), 0 warning(s)
我不清楚该消息的含义以及如何解决该错误