Reputation: 147
I am on Ubuntu 12.04 using g++ as a compiler, and I've run into a problem trying to use the Alignment enums to place my GUI objects appropriately. Here is the relevant code from guichan's graphics.hpp:
...
00053 namespace gcn
00054 {
00055 class Color;
00056 class Font;
00057 class Image;
00058
00094 class GCN_CORE_DECLSPEC Graphics
00095 {
00096 public:
00100 enum Alignment
00101 {
00102 LEFT = 0,
00103 CENTER,
00104 RIGHT
00105 };
...
Here is the line I am using to attempt to access the CENTER.
gcn::Graphics::Alignment _align = gcn::Graphics::Alignment::CENTER;
There error I receive is:
error: ‘gcn::Graphics::Alignment’ is not a class or namespace
I hope someone can give me a hand, I've searched everywhere for a similar problem, but to no avail.
Upvotes: 2
Views: 122
Reputation: 153840
The enumeration names are injected into the enclosing namespace unless you use enum class
which was introduced into C++ with the 2011 revision. If you use plain enum
, you just qualify the names with enclosing scope:
gcn::Graphics::CENTER
Upvotes: 2