Export (0) Print
Expand All
Expand Minimize

Compiler Error C3277

cannot define an unmanaged enum 'enum' inside managed 'type'

An enumeration was defined incorrectly inside a managed type.

The following sample generates C3277:

// C3277a.cpp
// compile with: /clr
ref class A
{
   enum E {e1,e2};   // C3277
   // try the following line instead
   // enum class E {e1,e2};
};

int main()
{
}

The following sample generates C3277:

// C3277b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
__gc class A
{
   enum E {e1,e2};   // C3277
   // try the following line instead
   // __value enum E {e1,e2};
};

int main()
{
}
Show:
© 2014 Microsoft