我有我在所有文件中包含的配置文件,我有不同的枚举,但在每个枚举中有相同的元素名称,例如:config.h
enum GameObjectType
{
NINJA_PLAYER
};
enum GameObjectTypeLocation
{
NONE,
MASSAGE_ALL, //this is for ComponentMadiator
NINJA_PLAYER
};
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用适当的枚举名称调用枚举来编译项目时
m_pNinjaPlayer = (NinjaPlayer*)GameFactory::Instance().getGameObj(GameObjectType::NINJA_PLAYER);
ComponentMadiator::Instance().Register(GameObjectTypeLocation::NINJA_PLAYER,m_pNinjaPlayer);
Run Code Online (Sandbox Code Playgroud)
我收到编译错误:
error C2365: 'NINJA_PLAYER' : redefinition; previous definition was 'enumerator' (..\Classes\GameFactory.cpp)
2> d:\dev\cpp\2d\cocos2d-x-3.0\cocos2d-x-3.0\projects\lettersfun\classes\config.h(22) : see declaration of 'NINJA_PLAYER'
Run Code Online (Sandbox Code Playgroud)
如何在config.h中保留几个具有不同名称但具有相同元素名称的枚举?