0

I have a simple offsets.cpp:

#pragma once
#include <Windows.h>

struct offsets_s {
    uintptr_t dwGlowObjectManager;
    uintptr_t m_iGlowIndex;
    uintptr_t dwEntityList;
    uintptr_t dwLocalPlayer;
    uintptr_t m_bDormant;
    uintptr_t m_iTeamNum;
} offsets;

offsets_s getOffsets() {
    return offsets;
}

void setOffsets() {
    offsets.dwGlowObjectManager = 0x528B880;
    offsets.m_iGlowIndex = 0xA428;
    offsets.dwEntityList = 0x4D43AB4;
    offsets.dwLocalPlayer = 0xD2FB84;
    offsets.m_bDormant = 0xED;
    offsets.m_iTeamNum = 0xF4;
}

And an offsets.h file for it:

#pragma once
#include <Windows.h>

struct offsets_s {
    uintptr_t dwGlowObjectManager;
    uintptr_t m_iGlowIndex;
    uintptr_t dwEntityList;
    uintptr_t dwLocalPlayer;
    uintptr_t m_bDormant;
    uintptr_t m_iTeamNum;
};

offsets_s getOffsets();

void setOffsets();

Here's the start of my Source.cpp:

#include <Windows.h>
#include "Offsets.h"

DWORD fMain(HMODULE hMod)
{
    uintptr_t client = (uintptr_t)GetModuleHandle(TEXT("client_panorama.dll"));

    offsets_s offsets = getOffsets();
    setOffsets();

When I try to compile it, it says that getOffsets() and setOffsets() are unresolved externals:

LNK2019 unresolved external symbol "struct offsets_s __cdecl getOffsets(void)" (?getOffsets@@YA?AUoffsets_s@@XZ) referenced in function "unsigned long __cdecl fMain(struct HINSTANCE__ *)" (?fMain@@YAKPAUHINSTANCE__@@@Z) - Source.obj line 1

LNK2019 unresolved external symbol "void __cdecl setOffsets(void)" (?setOffsets@@YAXXZ) referenced in function "unsigned long __cdecl fMain(struct HINSTANCE__ *)" (?fMain@@YAKPAUHINSTANCE__@@@Z)  - Source.obj line 1

What should I do to make the code work?

I think offsets.cpp compiled in, atleast according to this: solution explorer

discape
  • 337
  • 1
  • 15

0 Answers0