分享方式:


編譯程式警告 (層級 1, 錯誤) C4399

'symbol':當以 /clr:pure 編譯時,不應該以 __declspec(dllimport) 標示每個進程符號

備註

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

來自原生映像或具有原生和 Common Language Runtime (CLR) 建構的映射的數據無法匯入至純映像。 若要解決此警告,請使用 /clr 編譯 (不是 /clr:p ure) 或刪除 __declspec(dllimport)

這個警告可以發出為錯誤。 使用警告 pragma 來停用或變更警告層級。

範例

下列範例會產生 C4399。

// C4399.cpp
// compile with: /clr:pure /doc /W1 /c
__declspec(dllimport) __declspec(process) extern const int i;   // C4399