编译器警告(等级 1)C4917

更新:2007 年 11 月

错误消息

“declarator”: GUID 只能与类、接口或命名空间关联

classinterfacenamespace 之外的用户定义的结构不能有 GUID。

默认情况下关闭此警告。有关更多信息,请参见默认情况下处于关闭状态的编译器警告

下面的代码示例生成 C4917:

// C4917.cpp
// compile with: /W1
#pragma warning(default : 4917)
__declspec(uuid("00000000-0000-0000-0000-000000000001")) struct S
{
} s;   // C4917, don't put uuid on a struct

int main()
{
}