We recommend using Visual Studio 2017

Compiler Error C3150

 

The latest version of this topic can be found at Compiler Error C3150.

element' : 'attribute' can only be applied to a class, interface, array or pointer

__gc can only be used on a class, interface, or array.

C3150 is only reachable using /clr:oldSyntax.

The following sample generates C3150:

// C3150.cpp  
// compile with: /clr:oldSyntax  
#using <mscorlib.dll>  
  
__gc void f()   // C3150; function cannot be managed  
{  
}  

Show: