0

我在编译我的 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);
        }

我真的不知道我做错了什么,而且我以前也没有遇到过这个错误,所以我希望有人能帮助我,提前谢谢。

4

1 回答 1

3

您的CDetour类已声明成员函数GetThisPtr,但您的源 (.cpp) 文件均未提供定义。

由于您没有显示任何代码,因此无法进一步评论。

于 2012-08-06T04:06:23.753 回答