Saturday, 28 September 2013

Forward Declaring enum class not working

Forward Declaring enum class not working

In State.h I have
namespace States
{
enum class ID : unsigned int;
}
In State.cpp I have
namespace States
{
enum class ID : unsigned int
{
NullID = 0,
MainMenuID,
GamePlayID,
}
}
The problem is that any class that includes State.h has the forward
declaration, but I can't use any actual enum within a cpp file, like
States::ID::MainMenuID . The error says...
/home/lee/Projects/SuddenAwakening/Source/Game.cpp:24: error: 'MainMenuID'
is not a member of 'States::ID'
I'm running LinuxMint15KDE, g++ 4.7, and I am using c++11 features in
other parts like nullptr, unique_ptr, ect..., so it's not that I forgot
the compiler flag for c++11.

No comments:

Post a Comment