在编译DLL项目时得到了以下信息:
错误1错误LNK2019:未解决的外部符号“ public:unsigned char * __thiscall CDetour :: GetThisPtr(void)”(?GetThisPtr @ CDetour @@ QAEPAEXZ)在函数“ void __stdcall zCharacter_OnDamagedHook(struct ZObject *,struct D3DXVECTOR3,int,int)中引用” ,float,float,int)“(?zCharacter_OnDamagedHook @@ YGXPAUZObject @@ UD3DXVECTOR3 @@ HHMMH @ Z)C:\ Users \Andrés\ Documents \ Visual Studio 2010 \ Projects \ 2k7_A-H \ 2k7_A-H \ AntiLead.obj 2k7_A -H
我在这里使用“ zCharacter_OnDamagedHook”的位置是:
void __stdcall zCharacter_OnDamagedHook(ZObject* pAttacker, D3DXVECTOR3 srcPos, int damageType, int weaponType, float fDamage, float fPiercingRatio, int nMeleeType) {
zCharacter_OnDamagedDetour.Ret(true);
std::string channelName = ZGameClient::GetInstance()->CurrentChannel;
ZCharacter* victim = (ZCharacter*)zCharacter_OnDamagedDetour.GetThisPtr();
ZCharacter* attacker = (ZCharacter*)pAttacker;
ZCharacter* me = (ZCharacter*)ZGame::GetInstance()->pMyCharacter;
if ((channelName.find("[No-Lead]") == std::string::npos) && (channelName.find("[No-Lead]") == std::string::npos)) {
ZCharacterManager* charm = ZCharacterManager::GetInstance();
if (((attacker == me) && (victim != me)) && (damageType != 5) && (damageType != 1) && (damageType != 2)) {
zCharacter_OnDamagedDetour.Ret(false);
MUID uidVictim;
for (unsigned int i = 0; i < muidList.size(); ++i) {
if (charm->Find(muidList[i]) == victim) {
uidVictim = muidList[i];
break;
}
}
MCommand* pCmd = MCommand::Create(0xD3D9);
pCmd->AddParameter(new MCommandParameterInt(uidVictim.lowId));
pCmd->AddParameter(new MCommandParameterFloat(srcPos.x));
pCmd->AddParameter(new MCommandParameterFloat(srcPos.y));
pCmd->AddParameter(new MCommandParameterFloat(srcPos.z));
pCmd->AddParameter(new MCommandParameterInt(damageType));
pCmd->AddParameter(new MCommandParameterInt(weaponType));
pCmd->AddParameter(new MCommandParameterFloat(fDamage));
pCmd->AddParameter(new MCommandParameterFloat(fPiercingRatio));
pCmd->AddParameter(new MCommandParameterInt(nMeleeType));
MCommand::Post(pCmd);
}
我真的不知道我在做什么错,我之前也没有遇到这个错误,所以我希望有人能帮助我,事事如意。
最佳答案
您的CDetour
类已声明一个成员函数GetThisPtr
,但是您的源(.cpp)文件均未提供定义。
由于您没有显示任何代码,因此无法进一步注释。
关于c++ - 未解析的外部符号,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11822440/