我使用 Qt 5.4 和 MinGW。 我读到应该链接 uuid 库以避免此错误。在我的 .pro 文件中,我添加了
LIBS += libuuid libole32 liboleaut32
但是,即使我有这一行,我还是会收到 undefined reference 错误
D:\Dev\HinstStart\FileListData.cpp:74: ошибка: undefined reference to `IID_IImageList'
P.S: 如果我添加一些不存在的库,比如
LIBS += libuuid libole32 liboleaut32 liblol
然后我收到“找不到 -llol”错误。这就是我如何知道我的 LIBS 语句没有被忽略
最佳答案
使用 MinGW-w64 时,解决方案是包含 header #include <initguid.h>
, 在包括包含 COM 标识符的 header 之前,例如 commoncontrols.h
, mmdeviceapi.h
, endpointvolume.h
.
#include <initguid.h>
#include <commoncontrols.h>
#include <mmdeviceapi.h>
#include <endpointvolume.h>
解决方案位于 Undefined reference to CLSID_MMDeviceEnumerator and IID_IMMDeviceEnumerator
关于windows - 对 IID_ImageList 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31076570/