Export (0) Print
Expand All
Expand Minimize

Compiler Error C2472

'function' cannot be generated in managed code: 'message'; compile with /clr to generate a mixed image

This error will occur when types not supported by managed code are used within a pure common language runtime (CLR) environment. Compile with /clr to resolve the error.

The following sample generates C2472.

// C2472.cpp
// compile with: /clr:pure
// C2472 expected

#include <cstdlib>

int main()
{
   int * __ptr32 p32;
   int * __ptr64 p64;

   p32 = (int * __ptr32)malloc(4);
   p64 = p32;
}

Community Additions

ADD
Show:
© 2014 Microsoft