c++ - prototype for `' does not match any in class `' -
i've got problem while compilling program:
prototype int sromemory::readstring(unsigned int) not match in class sromemory
whats going on?
here's link 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 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"; { }while(!exit); }
and 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 , forgot 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; };
the function signature (in source file) doesn't match signature of prototype (declaration in header): change following line in source file:
int sromemory::readstring(unsigned int pointer)
to
string sromemory::readstring(unsigned int pointer)
another possibility according prototype... not match in class... (error). g++ is, source file includes wrong header file
Comments
Post a Comment