E2498 Need previously defined struct GUID (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

This happens when you use the __uuidof operator without including a header that defines the GUID struct. So the following program code would display this error:

class __declspec(uuid("19a76fe0-7494-11d0-8816-00a0c903b83c")) foo{};
int main()
{
    __uuidof(foo);
    return 0;
}

And you would fix it as follows:

#include <windows.h>    // Will pull in struct GUID
class __declspec(uuid("19a76fe0-7494-11d0-8816-00a0c903b83c")) foo{};
int main()
{
    __uuidof(foo);
    return 0;
}