This documentation is archived and is not being maintained.

Compiler Error C2778

improperly formed GUID in __declspec(uuid())

An incorrect GUID is supplied to the uuid extended attribute. The GUID must be a string of hexadecimal numbers with the following format:

// C2778a.cpp
// Correct:
struct __declspec(uuid("00000000-0000-0000-0000-000000000000")) A { };
struct __declspec(uuid("{00000000-0000-0000-0000-000000000000}")) B { };
int main()
{
}

Example

// C2778b.cpp
struct __declspec(uuid(" 00000000-0000-0000-0000-000000000000 ")) C { }; // C2778 expected
struct __declspec(uuid("00000000000000000000000000000000")) D { };
int main()
{
}

The uuid extended attribute accepts strings recognized by CLSIDFromString, with or without brace delimiters.

Show: