我的代码枚举在C++
void switchstate(gamestates state) --line 53
{ --line 54
switch(state)
case state_title:
title();
break;
case state_about:
break;
case state_game:
break;
case state_battle:
break;
}
enum gamestates
{
state_title, state_about, state_game, state_battle,
};
int main(int argc, char* args[])
{
gamestates currentstate = state_title;
startup();
load_resources();
switchstate(currentstate); --line 169
return 0;
}
,当我尝试编译我得到的错误:
\ main.cpp中:53:错误: 'gamestates' 没有在这个范围内声明
\ main.cpp:54:错误:预计','或';'之前 '{' 令牌
\ main.cpp中:在函数 '诠释SDL_main(INT,字符**)':
\ main.cpp中:169:错误: 'switchstate' 不能用作函数
我以前从未使用过枚举,所以我对什么不起作用感到困惑。