Megosztás a következőn keresztül:


C3883 fordítási hiba

"tag": inicializálni kell egy initonikusan statikus adattagot

Megjegyzések

A initonnal megjelölt változók inicializálása nem sikerült megfelelően.

Example

Az alábbi példa c3883-at hoz létre:

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

Az alábbi példa egy lehetséges megoldást mutat be:

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

Az alábbi példa bemutatja, hogyan inicializálhat statikus konstruktort:

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

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