编译器错误 C2472

更新:2007 年 11 月

错误消息

“function”无法在托管代码“message”中生成;请使用 /clr 进行编译以生成混合映像

当在纯公共语言运行库 (CLR) 环境中使用托管代码不支持的类型时,将出现此错误。请使用 /clr 进行编译,以消除该错误。

示例

下面的示例生成 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;
}

请参见

参考

/clr(公共语言运行库编译)