“identifier”:与此对象关联的多个 GUID
__uuidof 运算符采用附加了 GUID 的用户定义类型或此类用户定义类型的对象。 当参数是具有多个 GUID 的对象时,会发生此错误。
以下示例生成 C2788:
// C2788.cpp
#include <windows.h>
struct __declspec(uuid("00000001-0000-0000-0000-000000000000")) A {};
struct __declspec(uuid("{00000002-0000-0000-0000-000000000000}")) B {};
template <class T, class U> class MyClass {};
typedef MyClass<A,B> MyBadClass;
typedef MyClass<A,A> MyGoodClass;
int main() {
__uuidof(MyBadClass); // C2788
// try the following line instead
__uuidof(MyGoodClass);
}