Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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:
© 2015 Microsoft