1

I have been getting the :unresolved external symbol "public static int __cdecl Memory::Read (unsigned __int64,unsigned __int64_" for my declaration of a template function "Read"

It is defined in a class known as "memory" with the header file:

#ifndef MEMORY_H
#define MEMORY_H

#include <string>
#include "DataFuncs.h"

using namespace std;

  class Memory {

    public:
        template <typename type>
        static type Read(DWORD64 Address, SIZE_T size);
        static bool Write(DWORD64 Address, uintptr_t Value, SIZE_T size);       
  };

#endif

Its .cpp definition is the following:

#include "Memory.h"

template <typename type>
type Memory::Read(DWORD64 Address, SIZE_T size) {
    return Data.Read<type>(Process_ID, Address, size);
}

bool Memory::Write(DWORD64 Address, uintptr_t Value, SIZE_T size) {

    if (Data.Write(Address, Value, size))
        return true;
    return false;
}

The error does not occur until it is actually used in a different file. Its implementation is as follows:

#include "Memory.h"
#include "Special_Functions.h"

__int32 Special_Functions::Test(){

    __int32 x = Memory::Read<__int32>(0x20302, sizeof(__int32));
    return x;
}

If I take away the Memory::Read<__int32>(0x20302, sizeof(__int32)); line and just type return 53 then no compiling problems occur. Any idea why and how to fix it? Thanks!

joe biden
  • 11
  • 3

0 Answers0