Compiler Error C2505
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C2505.
symbol' : '__declspec(modifer)' can only be applied to declarations or definitions of global objects or static data members
A __declspec modifier that is designed to only be used at global scope was used in a function.
For more information, see appdomain and process.
The following sample generates 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
}
Show: