C++ 在非程序循环脚本中找不到标识符

C++ 在非程序循环脚本中找不到标识符,c++,game-engine,steamworks-api,C++,Game Engine,Steamworks Api,我试图查找“identifier not found”错误,只是为了找到函数必须移到主循环之外或应该使用转发声明的帖子。但是,我的脚本用作游戏引擎的模块,因此没有真正的主循环,问题函数由故障线上方的不同函数调用,没有问题: // Create a Steam ID CSteamID Steam::createSteamID(uint32 steamID, int accountType){ CSteamID cSteamID; if(accountType < 0 || a

我试图查找“identifier not found”错误,只是为了找到函数必须移到主循环之外或应该使用转发声明的帖子。但是,我的脚本用作游戏引擎的模块,因此没有真正的主循环,问题函数由故障线上方的不同函数调用,没有问题:

// Create a Steam ID
CSteamID Steam::createSteamID(uint32 steamID, int accountType){
    CSteamID cSteamID;
    if(accountType < 0 || accountType >= k_EAccountTypeMax){
        accountType = 1;
    }
    cSteamID.Set(steamID, EUniverse(k_EUniversePublic), EAccountType(accountType));
    return cSteamID;
}

// Set a Steam user as someone recently played with
void Steam::setPlayedWith(int steamID){
    if(SteamFriends() == NULL){
        return;
    }
    CSteamID friendID = createSteamID(steamID);
    SteamFriends()->SetPlayedWith(friendID);
}

// Get friend's Steam username
String getFriendPersonaName(int steamID){
    if(SteamFriends() == NULL || steamID == 0){
        return "";
    }
    CSteamID friendID = createSteamID(steamID);
    bool isDataLoading = SteamFriends()->RequestUserInformation(friendID, true);
    if(!isDataLoading){
        return SteamFriends()->GetFriendPersonaName(friendID);
    }
}
//创建一个蒸汽ID
CSteamID Steam::createSteamID(uint32-steamID,int-accountType){
CSteamID CSteamID;
如果(accountType<0 | | accountType>=k|EAccountTypeMax){
accountType=1;
}
cSteamID.Set(streamid、EUniverse(k_EUniversePublic)、EAccountType(accountType));
返回cSteamID;
}
//将Steam用户设置为最近玩过的用户
void Steam::setPlayedWith(int-steamID){
如果(SteamFriends()==NULL){
返回;
}
CSteamID-friendID=createstreamid(streamid);
SteamFriends()->SetPlayedWith(friendID);
}
//获取朋友的Steam用户名
字符串GetFriendPersonalName(int-steamID){
如果(SteamFriends()==NULL | | steamID==0){
返回“”;
}
CSteamID-friendID=createstreamid(streamid);
bool isDataLoading=SteamFriends()->RequestUserInformation(friendID,true);
如果(!isDataLoading){
return streamfriends()->getFriendPersonalName(friendID);
}
}
ID创建函数位于最顶端,这两个函数的出现要晚得多。第一个(setPlayedWith)成功,没有问题,但第二个(getFriendPersonalName)失败,原因是:“CreateStreamId”:编译脚本时找不到标识符

我有点不知所措,希望有人能给我指出正确的方向。

如果getFriendPersonaName()是一个成员函数,那么您忘记了以正确的方式定义它,因此它看起来像:

string Steam::getFriendPersonaName(int steamID)...
如果它不是成员,则您无法访问它。但是,只有当getFriendPersonaName()是一个friend函数时,您才能访问它,您应该在该函数中编辑签名以:

String getFriendPersonaName(int steamID, const steam& rhs);

谢谢你回答这个问题,而不是投反对票!我想这是一个简单的东西,因为我已经盯着它看了很长一段时间,所以我一直在忽略它。干杯,好的。听起来不错。我希望成员们互相帮助,而不是投票否决。是的,这就是Stackoverflow的意义所在。我可以理解我的问题,很明显,这是我疏忽的问题,但有时你需要另一双眼睛来观察一些事情。