【发布时间】:2018-05-22 16:49:06
【问题描述】:
对于连接到我的机器的设备,我想检索设备属性总线报告的设备描述。为此,我使用Setup API 的函数SetupDiGetDeviceProperty。在 devpkey.h 中,我找到了定义 DEVPKEY_Device_BusReportedDeviceDesc。
但如果我使用 DEVPKEY_Device_BusReportedDeviceDesc,我会在链接时收到未解析的外部符号 _DEVPKEY_Device_BusReportedDeviceDesc。
这是我的代码(仅包含重现问题的最少代码):
#include "stdafx.h"
#include <Windows.h>
#include <devpropdef.h>
#include <devpkey.h>
int main()
{
DEVPROPKEY x = DEVPKEY_Device_BusReportedDeviceDesc;
return 0;
}
这是完整的错误代码:
错误 LNK2001:无法解析的外部符号 _DEVPKEY_Device_BusReportedDeviceDesc
我该如何解决这个问题?
【问题讨论】:
标签: c++ visual-studio linker driver setupapi