返回

GDI+ 编译错误:如何修复 'EmfPlusRecordType' 不完整类型?

windows

GDI+ 编译错误:修复 'EmfPlusRecordType' 不完整类型

问题简介

在使用英特尔 DPC++ 2024 编译器编译包含 GDI+ 库的代码时,可能会遇到 'EmfPlusRecordType' is an incomplete type 错误。这是因为 GDI+ 头文件包含某些类型的向前声明,但这些类型的完整定义并不存在于头文件中。这可能导致编译器在遇到不完整类型的引用时出错。

解决方法

要解决此错误,请按照以下步骤操作:

  1. 打开位于 Windows 工具包目录中的 gdiplusenums.h 头文件(通常位于 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\GdiplusEnums.h)。

  2. 从第 554 行开始查找 EmfPlusRecordType 枚举的定义:

enum EmfPlusRecordType
{
    WmfRecordTypeHalt                      = GDIP_WMF_RECORD_BASE + 0,
    WmfRecordTypeSetPixelFormat            = GDIP_WMF_RECORD_BASE + 1,
    WmfRecordTypeSetBkMode                 = GDIP_WMF_RECORD_BASE + 2,
    WmfRecordTypeSetMapMode                = GDIP_WMF_RECORD_BASE + 3,
    WmfRecordTypeSetROP2                   = GDIP_WMF_RECORD_BASE + 4,
    WmfRecordTypeSetRelAbs                 = GDIP_WMF_RECORD_BASE + 5,
    WmfRecordTypeSetPolyFillMode           = GDIP_WMF_RECORD_BASE + 6,
    WmfRecordTypeSetStretchBltMode         = GDIP_WMF_RECORD_BASE + 7,
    WmfRecordTypeSetTextCharExtra          = GDIP_WMF_RECORD_BASE + 8,
    WmfRecordTypeSetTextColor              = GDIP_WMF_RECORD_BASE + 9,
    WmfRecordTypeSetTextJustification      = GDIP_WMF_RECORD_BASE + 10,
    WmfRecordTypeSetWindowOrg              = GDIP_WMF_RECORD_BASE + 11,
    WmfRecordTypeSetWindowExt              = GDIP_WMF_RECORD_BASE + 12,
    WmfRecordTypeSetViewportOrg            = GDIP_WMF_RECORD_BASE + 13,
    WmfRecordTypeSetViewportExt            = GDIP_WMF_RECORD_BASE + 14,
    WmfRecordTypeOffsetWindowOrg           = GDIP_WMF_RECORD_BASE + 15,
    WmfRecordTypeScaleWindowExt            = GDIP_WMF_RECORD_BASE + 16,
    WmfRecordTypeOffsetViewportOrg         = GDIP_WMF_RECORD_BASE + 17,
    WmfRecordTypeScaleViewportExt          = GDIP_WMF_RECORD_BASE + 18,
    WmfRecordTypeLineTo                    = GDIP_WMF_RECORD_BASE + 19,
    WmfRecordTypeMoveTo                    = GDIP_WMF_RECORD_BASE + 20,
    WmfRecordTypePolylineTo                = GDIP_WMF_RECORD_BASE + 21,
    WmfRecordTypePolyline                  = GDIP_WMF_RECORD_BASE + 22,
    WmfRecordTypePolyBezier                 = GDIP_WMF_RECORD_BASE + 23,
    WmfRecordTypePolygon                    = GDIP_WMF_RECORD_BASE + 24,
    WmfRecordTypePolyPolygon                = GDIP_WMF_RECORD_BASE + 25,
    WmfRecordTypePolyBezierTo               = GDIP_WMF_RECORD_BASE + 26,
    WmfRecordTypePolyLines                  = GDIP_WMF_RECORD_BASE + 27,
    WmfRecordTypeEscape                    = GDIP_WMF_RECORD_BASE + 28,
    WmfRecordTypeDeleteObject               = GDIP_WMF_RECORD_BASE + 29,
    WmfRecordTypePolyDraw                  = GDIP_WMF_RECORD_BASE + 30,
    WmfRecordTypeSetArcDirection           = GDIP_WMF_RECORD_BASE + 31,
    WmfRecordTypeSetBkColor                 = GDIP_WMF_RECORD_BASE + 32,
    WmfRecordTypeSetWindowPositions          = GDIP_WMF_RECORD_BASE + 33,
    WmfRecordTypeSetViewportPositions        = GDIP_WMF_RECORD_BASE + 34,
    WmfRecordTypeIntersectClipRect           = GDIP_WMF_RECORD_BASE + 35,
    WmfRecordTypeExcludeClipRect            = GDIP_WMF_RECORD_BASE + 36,
    WmfRecordTypeOffsetClipRgn              = GDIP_WMF_RECORD_BASE + 37,
    WmfRecordTypeMoveToEx                   = GDIP_WMF_RECORD_BASE + 38,
    WmfRecordTypeLineToEx                   = GDIP_WMF_RECORD_BASE + 39,
    WmfRecordTypePolylineToEx               = GDIP_WMF_RECORD_BASE + 40,
    WmfRecordTypePolylineEx                 = GDIP_WMF_RECORD_BASE + 41,
    WmfRecordTypePolyBezierToEx              = GDIP_WMF_RECORD_BASE + 42,
    WmfRecordTypePolygonEx                  = GDIP_WMF_RECORD_BASE + 43,
    WmfRecordTypePolyPolygonEx              = GDIP_WMF_RECORD_BASE + 44,
    WmfRecordTypePolyBezierToEx              = GDIP_WMF_RECORD_BASE + 45,
    WmfRecordTypePolyDrawEx                 = GDIP_WMF_RECORD_BASE + 46,
    WmfRecordTypeSetROP3                   = GDIP_WMF_RECORD_BASE + 47,
    WmfRecordTypeFillRgn                   = GDIP_WMF_RECORD_BASE + 48,
    WmfRecordTypeFrameRgn                   = GDIP_WMF_RECORD_BASE + 49,
    WmfRecordTypeInvertRgn                  = GDIP_WMF_RECORD_BASE + 50,
    WmfRecordTypePaintRgn                   = GDIP_WMF_RECORD_BASE + 51,
    WmfRecordTypeExtFloodFill              = GDIP_WMF_RECORD_BASE + 52,
    WmfRecordTypeSetTextAlign               = GDIP_WMF_RECORD_BASE + 53,
    WmfRecordTypeSetTabStops                = GDIP_WMF_RECORD_BASE + 54,
    WmfRecordTypeSetPolyFillModeEx          = GDIP_WMF_RECORD_BASE + 55,
    WmfRecordTypeSetBkColorEx               = GDIP_WMF_RECORD_BASE + 56,
    WmfRecordTypeSetTextJustificationEx     = GDIP_WMF_RECORD_BASE + 57,
    WmfRecordTypeSoftEdgeAdjust            = GDIP_WMF_RECORD_BASE + 58,
    WmfRecordTypeHardEdgeAdjust            = GDIP_WMF_RECORD_BASE + 59,
    WmfRecordTypeAddFontResourceEx           = GDIP_WMF_RECORD_BASE + 60,
    WmfRecordTypeAddFontMemResourceEx        = GDIP_WMF_RECORD_BASE + 61,
    WmfRecordTypeCreateDIBSection           = GDIP_WMF_RECORD_BASE + 62,
    WmfRecordTypeCreateDIBitmap             = GDIP_WMF_RECORD_BASE + 63,
    WmfRecordTypeExtCreateFontIndirectW      = GDIP_WMF_RECORD_BASE + 64,
    WmfRecordTypeExtTextOutW                 = GDIP_WMF_RECORD_BASE + 65,
    WmfRecordTypePolyBezier16                = GDIP_WMF_RECORD_BASE + 66,
    WmfRecordTypePolygon16                  = GDIP_WMF_RECORD_BASE + 67,
    WmfRecordTypePolylineTo16                = GDIP_WMF_RECORD_BASE + 68,
    WmfRecordTypePolyPolyline16             = GDIP_WMF_RECORD_BASE + 69,
    WmfRecordTypePolyBezierTo16              = GDIP_WMF_RECORD_BASE + 70,
    WmfRecordTypePolyDraw16                 = GDIP_WMF_RECORD_BASE +
  1. 在此枚举中,您可以看到 EmfPlusRecordType 实际上是一个包含大量常量的枚举。您可以使用以下代码将此枚举添加到您的代码