0

I have a simple Issue with my code, but I am somehow not able to solve it. I am using the code from an old project of mine and wanted to use that code in one of my newer projects.

So I literally copied and pasted the same code over to my new project solution which works flawless in the old source, but in the new one it gives me the following error code:

Severity Code Description Project File Line Suppression state
Error LNK2019 Reference to unresolved external symbol ""public: void __cdecl Hookxyz::Enable(void)" (?Enable@Hookxyz@@QEAAXXZ)" in function ""public: bool __cdecl rD3D11::HookD3D(void)" (?HookD3D@rD3D11@@QEAA_NXZ)". MyProject D:\MyProject\MyProject\rD3D11.obj 1   

In case you need more code to help me out, here is how my structure looks like:

hook.h:

#pragma once
#include <Windows.h>
class Hookxyz
{
public:

    BYTE* src{ nullptr };
    BYTE originalBytes[30]{ 0 };
    BYTE* dst{ nullptr };

    uintptr_t len{ 0 };
    uintptr_t* pTrampoline{ 0 };

    bool bEnabled{ false };
    void Enable();
};

hook.cpp:

#include "hook.h"
void Hookxyz::Enable()
{
    if (!bEnabled)
    {
        memcpy(originalBytes, src, len);
        * (uintptr_t*)pTrampoline = (uintptr_t)TrampHook64(src, dst, len);
        bEnabled = true;
    }
}

rD3D11.h:

#pragma once
#include "hook.h"
class rD3D11
{
public:
    Hookxyz presentHook;
};

D3D11.cpp:

#include "hook.h"
#include "rD3D11.h"
bool rD3D11::HookD3D()
{
    presentHook.Enable();
    return true;
}

So what exaclty is the issue, how can I solve this? I really appreciate any help, thanks a lot :)

Nenntron
  • 9
  • 3

0 Answers0