设置静态变量时出现以下错误
error: expected primary-expression before '.' token
“游戏场景.h”
#ifndef __GAME_SCENE_H__
#define __GAME_SCENE_H__
class Game {
public:
enum InteractionMode {
EDITING,
PLAYING };
static Game::InteractionMode mode;
}
#endif // __GAME_SCENE_H__
“游戏场景.cpp”
#include "GameScene.h"
Game *Game::singleton() {
if (_GameSingleton == NULL) {
_GameSingleton = Game::create();
Game::mode = Game::InteractionMode.PLAYING; //error on this line
}
return _GameSingleton;
}