The __uuidof operator takes a user-defined type with a GUID attached or an object of such a user-defined type. This error occurs when the argument is a user-defined type with no GUID. Ex:
#include <windows.h>
struct F {};
int main() {
__uuidof(F); // C2787
}
Possible resolution:
#include <windows.h>
struct __declspec(uuid("00000000-0000-0000-c000-000000000046")) F;
int main() {
__uuidof(F);
}
This article is a derivative work based on Compiler Error C2787 which is provided by MSDN Community Content - Visual C++.