我在编译我的 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);
}
我真的不知道我做错了什么,而且我以前也没有遇到过这个错误,所以我希望有人能帮助我,提前谢谢。