使用 wingdi.h 时我应该 link 哪个静态库?

Which static library should I link when using wingdi.h?

最近我尝试了FLTK。编译源代码后,我想使用 FLTK 创建一个小应用程序。

然而,在我尝试编译之后,g++说:

C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x298): undefined reference to '__imp_ExtCreateRegion' 
C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x2c4): undefined reference to '__imp_CombineRgn'
C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x2d4): undefined reference to '__imp_DeleteObject'
C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x351): undefined reference to '__imp_ExtCreateRegion'
C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x37d): undefined reference to '__imp_CombineRgn'
C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x38d): undefined reference to '__imp_DeleteObject'
C:\Program Files (x86)\FLTK\lib/libfltk.a(fl_color.cxx.obj):fl_color.cxx:(.text+0x65): undefined reference to '__imp_DeleteObject'
C:\Program Files (x86)\FLTK\lib/libfltk.a(fl_color.cxx.obj):fl_color.cxx:(.text+0x9f): undefined reference to '__imp_CreatePen'
C:\Program Files (x86)\FLTK\lib/libfltk.a(fl_color.cxx.obj):fl_color.cxx:(.text+0xc3): undefined reference to '__imp_SelectObject'
C:\Program Files (x86)\FLTK\lib/libfltk.a(fl_color.cxx.obj):fl_color.cxx:(.text+0x102): undefined reference to '__imp_SelectObject'

还有更多。我发现 ExtCreateRegion 和其他提到的函数在 windgi.h 中。那么,我应该 link 到哪个静态库?

大多数在 wingdi.h 中声明的函数需要链接到 gdi32.lib

例如,ExtCreateRegiondocumented here,该页面底部的详细信息包括:

  • Header: wingdi.h(包括 Windows.h)

  • 图书馆: Gdi32.lib

  • DLL: Gdi32.dll

which static library should I link?

gdi32.lib 不是 static 库,而是引用 gdi32.dllimport 库,它将在运行时加载并包含实际功能。