編譯器錯誤 C2434
'symbol': 以 __declspec(process) 宣告的符號無法在 /clr:pure 模式中動態初始化
備註
Visual Studio 2015 中已淘汰 /clr:pure 和 /clr:safe 編譯程序選項,且 Visual Studio 2017 不支援。
無法在 /clr:pure 下動態初始化個別進程變數。 如需詳細資訊,請參閱 /clr (Common Language Runtime 編譯) 和 進程。
範例
下列範例會產生 C2434。 若要修正此問題,請使用常數來初始化 process
變數。
// C2434.cpp
// compile with: /clr:pure /c
int f() { return 0; }
__declspec(process) int i = f(); // C2434
__declspec(process) int i2 = 0; // OK