Partilhar via


Erro do compilador C3808

'type' : uma classe com o atributo ComImport não pode definir membro 'member', apenas funções abstratas ou dllimport são permitidas

Observações

Um tipo derivado de ComImportAttribute não pode definir membro.

As opções do compilador /clr:pure e /clr:safe foram preteridas no Visual Studio 2015 e não têm suporte no Visual Studio 2017.

Example

O exemplo a seguir gera C3808.

// 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
};