编译器错误 C3734

“class”: 托管或 WinRT 类不能是组件类

组件类特性不能与托管或 WinRT 类一起使用。

下面的示例生成 C3734,并演示如何修复此错误:

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

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