Condividi tramite


Errore del compilatore C3175

'function1': impossibile chiamare un metodo di un tipo gestito dalla funzione non gestita 'function2'

Le funzioni non gestite non possono chiamare funzioni membro di classi gestite.

L'esempio seguente genera l'errore C3175:

// C3175_2.cpp
// compile with: /clr

ref struct A {
   static void func() {
   }
};

#pragma unmanaged   // remove this line to resolve

void func2() {
   A::func();   // C3175
}

#pragma managed

int main() {
   A ^a = gcnew A;
   func2();
}