RAD Studio |  |

E2498: Need previously defined struct GUID (C++)

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:

Copy Code

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

And you would fix it as follows:

Copy Code

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

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!