Compiler Error C3277
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at 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: