gpt4 book ai didi

C++ 关于方法的引用

转载 作者:行者123 更新时间:2023-11-27 23:21:15 25 4
gpt4 key购买 nike

<分区>

我有一个函数在

File2.cpp which contains the following code below

#include "File2.h"
//some codes in between

static float File2::computeData(string s,int a,int b,float c,float d)
{
float result;
//the compute code
return result;
}

在 File2.h 中,我试图在我的类里面声明它

Class File2
{
private:
//some variables
public:
static float computeData(string,int,int,float,float);
};

我得到一个错误,说不能声明成员函数 static float Data::computeData(std::string,int ,int , float , float) 有静态链接 [-fpermissive]

然后还有..在我的

main.cpp

我正在尝试使用该功能

#include "File2.h"

float result;
result = computeData(string s,int a,int b,float c,float d);

它给我 computeData was not declared in this scope..

衷心感谢所有帮助!

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com