编译器错误 C3862
“function”:不能使用 /clr:pure 或 /clr:safe 编译非托管函数
注解
“/clr:pure”和“/clr:safe”编译器选项在 Visual Studio 2015 中已弃用,并且在 Visual Studio 2017 中不受支持。
使用 /clr:pure 或 /clr:safe 进行编译将生成仅 MSIL 映像,即没有原生(非托管)代码的映像。 因此,不能在 /clr:pure 或 /clr:safe 编译中使用 unmanaged
pragma。
有关详细信息,请参阅 /clr(公共语言运行时编译)和托管、非托管。
示例
以下示例生成 C3862:
// C3862.cpp
// compile with: /clr:pure /c
#pragma unmanaged
void f() {} // C3862