编译器错误 C2348
“type name”:不是 C 样式聚合,无法在嵌入的 IDL 中导出
若要将 struct
放置在具有 export 属性的 .idl 文件中,struct
必须仅包含数据。
下面的示例生成 C2348:
// C2348.cpp
// C2348 error expected
[ module(name="SimpleMidlTest") ];
[export]
struct Point {
// Delete the following two lines to resolve.
Point() : m_i(0), m_j(0) {}
Point(int i, int j) : m_i(i), m_j(j) {}
int m_i;
int m_j;
};