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
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.

uuid (C++ Attributes)

Specifies the unique ID for a class or interface.

[ uuid( 
   "uuid" 
) ]

uuid

A 128-bit, unique identifier.

If the definition of an interface or class does not specify the uuid C++ attribute, then the Visual C++ compiler will provide one.

If you do not specify uuid, then the compiler will generate the same GUID for interfaces or classes with the same name in different attribute projects on a machine.

You can use Uuidgen.exe or Guidgen.exe to generate your own unique IDs. (To run either of these tools, click Start and click Run on the menu. Then enter the name of the required tool.)

When used in a project that does not also use ATL, specifying the uuid attribute is the same as specifying the uuid __declspec modifier. To retrieve the uuid of a class, you can use __uuidof

See the bindable example for a sample use of uuid.

Attribute Context

Applies to

class, struct, interface, union, enum

Repeatable

No

Required attributes

None

Invalid attributes

None

For more information about the attribute contexts, see Attribute Contexts.

Community Additions

ADD
Show:
© 2015 Microsoft