使用 GetDIBits 函数对 _imp__GetDIBits@28 的未定义引用

undefined reference to _imp__GetDIBits@28 with GetDIBits function

我正在尝试在 Windows 上将 GetDIBits 函数与 C++(使用 QtCreator)一起使用。代码编译但不能 link 错误

undefined reference to _imp__GetDIBits@28

我尝试 link 添加

LIBS = C:/MinGW/lib/libws2_32.a

到我的 .pro 文件,但没有任何改变。 它是正确的库还是另一个库?谢谢

Link 与 Gdi32.lib.

一般来说,要确定 link 使用哪个库,请在 msdn.microsoft.com 上查找 API,然后滚动到页面底部找到 headers 和库要求。

示例here