Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1002 Bytes

compiler-error-c2346.md

File metadata and controls

45 lines (35 loc) · 1002 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Error C2346
Compiler Error C2346
11/04/2016
C2346
C2346
246145be-5645-4cd6-867c-e3bc39e33dca

Compiler Error C2346

'function' cannot be compiled as native: reason

The compiler was unable to compile a function to MSIL.

For more information, see managed, unmanaged and /clr (Common Language Runtime Compilation).

To correct this error

  1. Remove the code in the function that cannot be compiled to MSIL.

  2. Either do not compile the module with /clr, or mark the function as unmanaged with the unmanaged pragma.

Example

The following sample generates C2346.

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

int main()
{
   S s;
}