Teilen über


Compilerfehler C3808

'type' : Eine Klasse mit dem ComImport-Attribut kann member 'member' nicht definieren, nur abstrakte oder dllimport-Funktionen sind zulässig.

Hinweise

Ein vom Element abgeleiteter Typ, der ComImportAttribute nicht definiert werden kann.

Die Optionen "/clr:pure " und "/clr:safe compiler" sind in Visual Studio 2015 veraltet und werden in Visual Studio 2017 nicht unterstützt.

Beispiel

Im folgenden Beispiel wird C3808 generiert.

// C3808.cpp
// compile with: /c /clr:pure user32.lib
using namespace System::Runtime::InteropServices;

[System::Runtime::InteropServices::ComImportAttribute()]
ref struct S1 {
   int f() {}   // C3808
   virtual int g() abstract;   // OK

   [DllImport("msvcrt.dll")]
   int printf(System::String ^, int i);   // OK
};