gpt4 book ai didi

c++ - 在 VC++ 中解决 hid.lib "unresolved external symbol"链接器错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:12:39 24 4
gpt4 key购买 nike

如标题所示,我遇到以下链接器错误:

error LNK2019: unresolved external symbol "unsigned char __stdcall HidD_GetAttributes(void *,struct _HIDD_ATTRIBUTES *)" (?HidD_GetAttributes@@YGEPAXPAU_HIDD_ATTRIBUTES@@@Z)

在我的代码中调用 result = HidD_GetAttributes(WriteHandle, &attributes) 时。

这个函数应该存在于“hid.lib”中,我已将其添加到项目的链接器依赖项中。我还包含了头文件“hidsdi.h”,它具有 HidD_GetAttributes 的函数原型(prototype)。

我认为唯一可能有问题的是“hid.lib”的函数原型(prototype)分为三个不同的头文件:hidsdi.h、hidpi.h 和 hidsage.h。

有什么建议吗?

最佳答案

刚刚解决了这个问题。显然,“hid.lib”是用 C 语言编写的,这导致了一些名称混淆。使用

extern "C"
{
#include "hidsdi.h"
}

清理一切。

关于c++ - 在 VC++ 中解决 hid.lib "unresolved external symbol"链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7614606/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com