共用方式為


編譯器錯誤 C3389

__declspec(keyword) 不能配合 /clr:pure 或 /clr:safe 使用

備註

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

使用的 __declspec 修飾元表示每個程序的狀態。 /clr:pure 表示每個 appdomain 狀態。 因此,不允許使用 keyword __declspec 修飾元宣告變數,以及使用 /clr:pure 編譯。

範例

下列範例會產生 C3389:

// C3389.cpp
// compile with: /clr:pure /c
__declspec(dllexport) int g2 = 0;   // C3389