Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C2778

Error Message

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
// compile with: /c
struct __declspec(uuid("00000000-0000-0000-0000-000000000000")) A {};
struct __declspec(uuid("{00000000-0000-0000-0000-000000000000}")) B{};

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

The following sample generates C2778:

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

Community Additions

© 2015 Microsoft