共用方式為


編譯器錯誤 C3862

'function': 無法使用 /clr:pure 或 /clr:safe 編譯 Unmanaged 函式

備註

Visual Studio 2015 中已淘汰 /clr:pure/clr:safe 編譯程序選項,且 Visual Studio 2017 不支援。

使用 /clr:pure/clr:safe 編譯會產生僅限 MSIL 的映射,且沒有原生 (Unmanaged) 程式代碼的映射。 因此,您無法在 /clr:pure 或 /clr:safe 編譯中使用 unmanagedpragma

如需詳細資訊,請參閱 /clr(Common Language Runtime 編譯)Managed、Unmanaged

範例

下列範例會產生 C3862:

// C3862.cpp
// compile with: /clr:pure /c
#pragma unmanaged
void f() {}   // C3862