'object' : cannot declare a global or static managed object or a gc pointer
You can only define NGWS objects within function scope.
The following sample generates C3145:
#using <mscorlib.dll> Object *o; // C3145, declaring in main is OK __gc class X { public: void mf() { static X *pX = new X(); // C3145 // try the following line instead // X *pX = new X(); } }; void main() { Object *p; }