Share via


編譯器警告 (層級 1) C4917

'declarator' :GUID 只能與類別、介面或命名空間相關聯

類別 介面 命名空間 以外的 使用者定義結構不能有 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()
{
}