This documentation is archived and is not being maintained.

Compiler Error C2158

'type' : #pragma make_public directive is currently supported for native non-template types only

The make_public pragma can only be applied to a native, non-template type.

The following sample generates C2158.

// C2158.cpp
// compile with: /clr /c
ref class A {};
#pragma make_public(A)   // C2158

template< typename T >
class B {};
#pragma make_public(B)   // C2158
#pragma make_public(B<int>)   // C2158

void C () {}
#pragma make_public(C)   // C2158

class D {};
#pragma make_public(D)   // OK