共用方式為


編譯器錯誤 C2505

'symbol': '__declspec(modifer)' 只能套用至全域對象或靜態數據成員的宣告或定義

備註

__declspec設計成只在全域範圍中使用的修飾詞是在函式中使用。

如需詳細資訊,請參閱 appdomain處理序

Example

下列範例會產生 C2505:

// C2505.cpp
// compile with: /clr

// OK
__declspec(process) int ii;
__declspec(appdomain) int jj;

int main() {
   __declspec(process) int i;   // C2505
   __declspec(appdomain) int j;   // C2505
}