共用方式為


編譯器錯誤 C2479

'identifier' : 'allocate( )' 僅適用於靜態範圍的數據項

語法 __declspec( allocate()) 只能用於靜態數據。

下列範例會產生 C2479:

// C2479.cpp
// compile with: /c
#pragma section("mycode", read)
static __declspec(allocate("mycode")) void DoNothing() {}   // C2479
__declspec(allocate("mycode"))  int i = 0;   // OK