如何使用PKEY_Device_FriendlyName修复链接器错误 [英] How to fix a linker error with PKEY_Device_FriendlyName
问题描述
使用PKEY_Device_FriendlyName时,出现以下错误:
Upon using PKEY_Device_FriendlyName, I'm getting the following errors:
Error 1 error LNK2001: unresolved external symbol _PKEY_Device_FriendlyName DefaultAudioDeviceCPP.obj
Error 2 fatal error LNK1120: 1 unresolved externals C:\Users\srobertson\Documents\Visual Studio 2005\Projects\DefaultAudioDeviceCPP\Debug\DefaultAudioDeviceCPP.exe
清除这些错误的最简单方法是什么?我包括functiondiscovery.h和functiondiscoverykeys.h.另外,Project-> Properties ...-> Configuration Properties-> C/C ++-> General-> Additional Include Directories中的路径也是正确的.
What's a very simple way to clear these errors? I'm including functiondiscovery.h and functiondiscoverykeys.h. Also the path in Project->Properties...->Configuration Properties->C/C++->General->Additional Include Directories is correct.
有趣的是,提到的错误是:_PKEY_Device_FriendlyName,而不是PKEY_Device_FriendlyName.但是我只在程序中使用后者.
One thing of interest is that the errors are mentioning: _PKEY_Device_FriendlyName, not PKEY_Device_FriendlyName. But I'm only using the latter in my program.
推荐答案
PKEY_Device_FriendlyName
驻留在uuid.lib
库中.因此,您需要在源代码中添加一行:
PKEY_Device_FriendlyName
resides in uuid.lib
library. So you need to add a line to your source code:
#pragma comment(lib, "uuid.lib")
通常,您可以与MSDN一起检查您需要引用哪个库.
Most often, you can check with MSDN which library you need to reference.
这篇关于如何使用PKEY_Device_FriendlyName修复链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!