This documentation is archived and is not being maintained.

Compiler Error C3734

'class': a managed class cannot be a coclass

The coclass attribute cannot be used with managed classes.

The following sample generates C3734:

// C3734.cpp
// compile with: /clr /c
[module(name="x")];

[coclass]
ref class CMyClass {   // C3734 remove the ref keyword to resolve
};

The following sample generates C3734:

// C3734_b.cpp
// compile with: /clr:oldSyntax /c
[module(name="x")];

[coclass]
__gc class CMyClass {   // C3734 remove the __gc keyword to resolve
};
Show: