Partager via


Compiler Error C2599 

Error Message

'enum' : forward declaration of enum type is not allowed

Forward declaration of an enum type is not allowed under /Za.

Beginning in Visual C++ 2005, Managed Extensions for C++ no longer support forward declarations of managed enums. See Breaking Changes in the Visual C++ 2005 Compiler for more information.

The following sample generates C2599:

// C2599.cpp
// compile with: /clr /c
enum class Status;   // C2599

enum class Status2 { stop2, hold2, go2}; 

ref struct MyStruct {
   // Delete the following line to resolve.
   Status m_status;

   Status2 m_status2;   // OK
};

enum class Status { stop, hold, go };