MODE1
is in the scope of foo
, so you need
bar->mode = foo::MODE1;
Note that if you want to access the enum types without a scope, you would need to declare them so. For example:
typedef enum {MODE1, MODE2, MODE3} MODE;
typedef enum {TYPE1, TYPE2} TYPE;
struct foo
{
MODE mode;
TYPE type;
};