컴파일러 오류 C3883

'member': 정적 데이터 멤버를 초기화해야 합니다.

비고

initonly표시된 변수가 올바르게 초기화되지 않았습니다.

Example

다음 예제에서는 C3883을 생성합니다.

// C3883.cpp
// compile with: /clr
ref struct Y1 {
   initonly
   static int staticConst1;   // C3883
};

다음 예제에서는 가능한 해결 방법을 보여 줍니다.

// C3883b.cpp
// compile with: /clr /c
ref struct Y1 {
   initonly
   static int staticConst2 = 0;
};

다음 예제에서는 정적 생성자에서 초기화하는 방법을 보여줍니다.

// C3883c.cpp
// compile with: /clr /LD
ref struct Y1 {
   initonly
   static int staticConst1;

   static Y1() {
      staticConst1 = 0;
   }
};