我在Visual Studio中有一個解決方案,它有2個項目,即PAL_TEST和Unit_Test。
我有PAL_TEST類,CPALResponse.h無法解決錯誤LNK2019:無法解析的外部符號
#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)" ([email protected]@@[email protected]) 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)
目前還不清楚我的消息意味着什麼和如何解決錯誤
@EitanT沒有幫助 – 2012-07-11 10:05:10
這三個文件位於哪裏? – 2012-07-11 10:11:24