Can't Build PortAudio - “LNK1104: cannot open file 'ksguid.lib'”

☆樱花仙子☆ 提交于 2019-12-07 13:55:46

问题


I'm a beginner in C/C++, so please bear with me.

I'm trying to build the PortAudio library so I can use it in one of my project. I'm using VS 2013, the preset project-file for builds had to be converted to my version. I've been able to fix all the many problems that occurred on my long way here, except one:

LINK : fatal error LNK1104: cannot open file 'ksguid.lib'

I've seen this and this site. All of them address exactly this problem, yet non of them has been able to solve it. Here are the solutions these sites suggest:

  • Add WASAPI - symbol to portaudio.def,
  • Add PA_WDMKS_NO_KSGUID_LIB - definition to the preprocessor

回答1:


You can get the ksguid.lib-file from the Windows 7 SDK. It might even already be installed on your computer. It's best to use the explorer to find it (probably C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64).

When you found it, go back to Visual Studio and go to Project > Properties > Configuration-Properties > Linker > Input, then click on the little arrow on the right of Additional Dependencies and choose edit:

Enter the absolute filepath to ksguid.lib. Make sure that you surrounded it with "-s and that you put a ; at the end. (Throws an error without a usable description otherwise - Microsoft as we know it.)

Source: Bitbucket, stackoverflow




回答2:


ksguid.lib is included in the Windows 7, 8, 8.1, and windows 10 sdk. The answer provided by @Nearoo is perfectly valid. This alternative answer involves modifying what directories the portaudio Visual Studio project looks for library files.

For reference, I'm using Visual Studio 2013 on a Windows 8.1 PC.
Navigate to: Project -> Properties -> VC++ Directories At the top of the window,

  1. change Configuration to "All Configurations".
  2. change Platform to "All Platforms"
  3. In the "Library Directories" portion, add the following path:

    $(WindowsSdkDir)\Lib\winv6.3\km\$(PlatformTarget)\

This nice thing is that this one path uses macros so it will work with Debug, Release, 32 bit and 64 bit builds of portaudio.



来源:https://stackoverflow.com/questions/29550887/cant-build-portaudio-lnk1104-cannot-open-file-ksguid-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!