编译器错误 C3708
“interface”:“keyword”的用法不正确;必须是兼容事件源的成员
若要将接口声明为事件,该事件声明必须位于事件源中。
以下示例生成 C3708:
// C3708.cpp
// compile with: /c
#define _ATL_ATTRIBUTES 1
#include "atlbase.h"
#include "atlcom.h"
[ module(name="MyLibrary")];
[ object, uuid("00000000-0000-0000-0000-000000000001") ]
__interface I {
HRESULT func();
};
[ object, uuid("00000000-0000-0000-0000-000000000002") ]
__interface II {
HRESULT func();
};
__event __interface I; // C3708
// put the event in an event source
[ coclass, event_source(com), uuid("00000000-0000-0000-0000-000000000003") ]
struct E : II {
__event __interface II;
};