结构由于某种原因不能识别成员
Structure not recognizing a member for some reason
当运行这段代码时,它给了我一个奇怪的错误。我有一个类叫scene, scene有一个数组成员叫"commands"。我有一个结构体cGame,它有一个成员current scene。
struct MainGameLoop{
void init(){
this->cGame.init();
}
game_struct cGame;
void begin_cipher(string input){
if(input == "save" || input == "SAVE"){
cGame.cPlayer.save_game();
cout << "nnGame saved...";
}
if(input == "back" || input == "BACK"){
cGame.go_back();
}
if(input != "back" && input != "BACK" && input != "save" && input != "SAVE"){
bool is_recognized_scene_command;
for(int c = 0; c < 11 ; c++){
if(input == cGame.scene_container[this->cGame.current_scene].commands[c]){
cout << "nnREQUEST IS RECOGNIZED BY SCENE...";
}
else{
cout << "REQUEST IS NOT RECOGNIZED!";
}
}
}
}
};
下面的代码给出了错误:
279 C:Dev-Cppthe_main_mage.cpp no match for 'operator[]' in '((MainGameLoop*)this)->MainGameLoop::cGame.game_struct::scene_container[((MainGameLoop*)this)->MainGameLoop::cGame.game_struct::current_scene]'
错误是关于scene_container
。你确定这是一个数组/向量/…可以用[]
索引吗?current_scene
是作为索引的正确类型吗?
相关文章:
- 复制构造函数无法识别继承的成员
- Clang 无法识别受保护的数据成员
- 编译器无法识别我的结构成员
- auto f = bind(dist<>,gen) 在成员声明C++失败。未被识别为函数
- 当尝试使用它来初始化数组时,未识别C const静态成员
- 编译器未识别从类函数的呼叫作为课堂成员
- 动态强制转换无法识别成员
- 嵌套成员类型识别
- 类继承:编译器无法识别类的构造函数和成员函数
- 编译器无法识别实现文件中的类成员函数类型,但在接口文件中已识别
- 具有多个被识别为只有一个成员的结构的列表
- 在函数中无法识别类的成员函数
- NetBeans 在生成+运行时无法识别C++类成员
- 子构造函数无法识别基类的成员:平均值,西格玛"is not a nonstatic data member or base class"
- singleton--cpp文件中无法识别的静态成员
- 识别自动生成的成员函数
- c++:类的成员不能被识别
- 结构由于某种原因不能识别成员
- Valgrind在使用字符串类型成员(使用nvcc编译)时识别内存泄漏
- 在Mac OSX Yosemite上,编译器无法识别父类成员变量(Apple LLVM 7.0)