C++ `' 的原型与类 `' 中的任何内容都不匹配

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25360165/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 11:18:14  来源:igfitidea点击:

prototype for `' does not match any in class `'

c++

提问by ?ukasz Rad?owski

I've got problem while compilling my program:

编译我的程序时遇到问题:

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

int SROMemory::ReadString(unsigned int) 的原型与 SROMemory 类中的任何内容都不匹配

Whats going on?

这是怎么回事?

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

这是我的 Dev C++ 项目的链接: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] = "
#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);
}
"; ReadProcessMemory(PROC_HANDLE, (LPVOID)Pointer, &cValue, sizeof(cValue), NULL); string Value = cValue; return Value; }

this is main.cpp:

这是 main.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] = "
#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;
};
"; ReadProcessMemory(PROC_HANDLE, (LPVOID)Pointer, &cValue, sizeof(cValue), NULL); string Value = cValue; return Value; }

and this is memory.cpp:

这是 memory.cpp:

int SROMemory::ReadString(unsigned int Pointer)

Yup and i forgot about memory.h:

是的,我忘记了 memory.h:

string SROMemory::ReadString(unsigned int Pointer)

采纳答案by BeyelerStudios

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:

函数签名(在源文件中)与原型的签名(在标题中声明)不匹配:更改源文件中的以下行:

##代码##

to

##代码##

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

根据原型的另一种可能性......与类中的任何内容都不匹配......(错误)。g++是,您的源文件包含错误的头文件