Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

prototype for `' does not match any in class `' [closed]

Tags:

c++

I've got problem while compilling my program:

prototype for int SROMemory::ReadString(unsigned int) does not match any in class SROMemory

Whats going on?

Here's a link to my Dev C++ project: https://www.sendspace.com/file/uop8m8

#include "memory.h"

SROMemory::SROMemory()
{
          GetWindowThreadProcessId(FindWindow(NULL, (LPCSTR)TEXT("Tibia")), &PROC_ID);
          PROC_HANDLE = OpenProcess(0x10, false, PROC_ID);
}

int SROMemory::ReadString(unsigned int Pointer)
{
        char cValue[24] = "\0";
        ReadProcessMemory(PROC_HANDLE, (LPVOID)Pointer, &cValue, sizeof(cValue), NULL);
        string Value = cValue;
        return Value;
}

this is main.cpp:

#include <iostream>
#include "memory.h"

using namespace std;

int main(void)
{
     bool exit = false;

     SROMemory Memory;

     string loginPass = Memory.ReadString(0x78F554);

     cout << "LoginPass: " << loginPass << "\n";

     do
     {

     }while(!exit);
}

and this is memory.cpp:

#include "memory.h"

SROMemory::SROMemory()
{
          GetWindowThreadProcessId(FindWindow(NULL, (LPCSTR)TEXT("Tibia")), &PROC_ID);
          PROC_HANDLE = OpenProcess(0x10, false, PROC_ID);
}

int SROMemory::ReadString(unsigned int Pointer)
{
        char cValue[24] = "\0";
        ReadProcessMemory(PROC_HANDLE, (LPVOID)Pointer, &cValue, sizeof(cValue), NULL);
        string Value = cValue;
        return Value;
}

Yup and i forgot about memory.h:

#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>

using namespace std;

class SROMemory
{
    public:
        SROMemory();
        int ReadPointer(unsigned int Pointer);
        int ReadOffset(unsigned int Offset);
        string ReadString(unsigned int Pointer);
    private:
        DWORD PROC_ID;
        HANDLE PROC_HANDLE;
};
like image 605
Łukasz Radłowski Avatar asked Aug 18 '14 09:08

Łukasz Radłowski


1 Answers

the function signature (in the source file) doesn't match the signature of the prototype (declaration in header): change the following line in your source file:

int SROMemory::ReadString(unsigned int Pointer)

to

string SROMemory::ReadString(unsigned int Pointer)

another possibility according to Prototype... does not match any in Class... (error). g++ is, that your source file includes the wrong header file

like image 78
BeyelerStudios Avatar answered Nov 06 '22 20:11

BeyelerStudios