Compartilhar via


Erro do compilador C3808

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

Comentários

Um tipo derivado de ComImportAttribute pode definir member.

As opções do compilador /clr:pure e /clr:safe foram preteridas no Visual Studio 2015 são incompatíveis com o Visual Studio 2017.

Exemplo

O exemplo a seguir gera o erro 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
};