"'EmfPlusRecordType' is an incomplete type" compilation error with Intel DPC++ 2024

42 Views Asked by At

I'm compiling the GDI+ library in my code:

#include <gdiplus.h>

It works fine with the MSVC compiler but when using the Intel DPC++ 2024 compiler, I get the compilation error 'EmfPlusRecordType' is an incomplete type inside the gdiplusenums.h header:

The code seems fine, also it's a standard GDI+ header. Any ideas on how it can be fixed (without editing standard headers)? The full error output is below:

1>In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\gdiplus.h:45:
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(560,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  560 |     WmfRecordTypeSetBkColor              = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKCOLOR),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(561,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  561 |     WmfRecordTypeSetBkMode               = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKMODE),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(562,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  562 |     WmfRecordTypeSetMapMode              = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETMAPMODE),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(563,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  563 |     WmfRecordTypeSetROP2                 = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETROP2),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(564,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  564 |     WmfRecordTypeSetRelAbs               = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETRELABS),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(565,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  565 |     WmfRecordTypeSetPolyFillMode         = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPOLYFILLMODE),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(566,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  566 |     WmfRecordTypeSetStretchBltMode       = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETSTRETCHBLTMODE),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(567,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  567 |     WmfRecordTypeSetTextCharExtra        = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCHAREXTRA),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(568,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  568 |     WmfRecordTypeSetTextColor            = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCOLOR),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(569,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  569 |     WmfRecordTypeSetTextJustification    = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTJUSTIFICATION),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(570,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  570 |     WmfRecordTypeSetWindowOrg            = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWORG),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(571,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  571 |     WmfRecordTypeSetWindowExt            = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWEXT),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(572,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  572 |     WmfRecordTypeSetViewportOrg          = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTORG),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(573,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  573 |     WmfRecordTypeSetViewportExt          = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTEXT),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(574,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  574 |     WmfRecordTypeOffsetWindowOrg         = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETWINDOWORG),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(575,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  575 |     WmfRecordTypeScaleWindowExt          = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEWINDOWEXT),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(576,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  576 |     WmfRecordTypeOffsetViewportOrg       = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETVIEWPORTORG),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(577,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  577 |     WmfRecordTypeScaleViewportExt        = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEVIEWPORTEXT),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(578,44): : error : 'EmfPlusRecordType' is an incomplete type
1>  578 |     WmfRecordTypeLineTo                  = GDIP_WMF_RECORD_TO_EMFPLUS(META_LINETO),
1>      |                                            ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(550,42): note: expanded from macro 'GDIP_WMF_RECORD_TO_EMFPLUS'
1>  550 | #define GDIP_WMF_RECORD_TO_EMFPLUS(n)   ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
1>      |                                          ^
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h(554,6): note: definition of 'Gdiplus::EmfPlusRecordType' is not complete until the closing '}'
1>  554 | enum EmfPlusRecordType
1>      |      ^
1>fatal error: too many errors emitted, stopping now [-ferror-limit=]
1>2 warnings and 20 errors generated.

Reproduction code:

#include <Windows.h>
#include <gdiplus.h>

#pragma comment(lib, "gdiplus.lib")

using namespace Gdiplus;

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    GdiplusStartupInput gdiplusStartupInput;
    ULONG_PTR gdiplusToken;
    GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);

    const wchar_t CLASS_NAME[] = L"HelloWorldClass";

    WNDCLASS wc = {};
    wc.lpfnWndProc = WndProc;
    wc.hInstance = hInstance;
    wc.lpszClassName = CLASS_NAME;
    RegisterClass(&wc);

    HWND hwnd = CreateWindowEx(
        0,
        CLASS_NAME,
        L"Hello, World!",
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, 500, 400,
        nullptr, nullptr, hInstance, nullptr
    );

    if (hwnd == nullptr)
    {
        return 0;
    }

    ShowWindow(hwnd, nCmdShow);

    MSG msg = {};
    while (GetMessage(&msg, nullptr, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    GdiplusShutdown(gdiplusToken);

    return 0;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_PAINT:
    {
        PAINTSTRUCT ps;
        HDC hdc = BeginPaint(hWnd, &ps);

        // Use GDI+ to draw "Hello, World!"
        Graphics graphics(hdc);
        Font font(L"Arial", 20);
        SolidBrush brush(Color(255, 0, 0, 0));
        PointF point(50.0f, 50.0f);
        graphics.DrawString(L"Hello, World!", -1, &font, point, &brush);

        EndPaint(hWnd, &ps);
    }
    break;

    case WM_DESTROY:
        PostQuitMessage(0);
        break;

    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }

    return 0;
}

Note:
To compile with MSVC, you need to change the SubSystem property to Windows (/SUBSYSTEM:WINDOWS).:

0

There are 0 best solutions below