Condividi tramite


Errore del compilatore C2346

'function' non può essere compilato come nativo: reason

Osservazioni:

Il compilatore non è riuscito a compilare una funzione in MSIL.

Per altre informazioni, vedere managed, unmanaged e /clr (Common Language Runtime Compilation).For more information, see managed, unmanaged and /clr (Common Language Runtime Compilation).

Per correggere l'errore

  1. Rimuovere il codice nella funzione che non può essere compilato in MSIL.

  2. Non compilare il modulo con /clr o contrassegnare la funzione come non gestita con il pragma non gestito.

Esempio

L'esempio seguente genera l'errore C2346.

// C2346.cpp
// processor: x86
// compile with: /clr
// C2346 expected
struct S
{
   S()
   {
      { __asm { nop } }
   }
   virtual __clrcall ~S() { }
};

int main()
{
   S s;
}