gpt4 book ai didi

c++ - 使用系统设备枚举器选择捕获设备

转载 作者:可可西里 更新时间:2023-11-01 11:56:00 26 4
gpt4 key购买 nike

我想使用这个链接:http://msdn.microsoft.com/en-us/library/dd377566%28v=VS.85%29.aspx , 选择捕获设备。

在 Visual Studio 上完美运行,但会抛出以下错误 QT:

 test.obj : error LNK2005: _main already defined in main.obj
test.obj : error LNK2019: unresolved external symbol __imp__CoCreateInstance@20 referenced in function "long __cdecl EnumerateDevices(struct _GUID const &,struct IEnumMoniker * *)" (?EnumerateDevices@@YAJABU_GUID@@PAPAUIEnumMoniker@@@Z)
test.obj : error LNK2019: unresolved external symbol __imp__VariantClear@4 referenced in function "void __cdecl DisplayDeviceInformation(struct IEnumMoniker *)" (?DisplayDeviceInformation@@YAXPAUIEnumMoniker@@@Z)
test.obj : error LNK2019: unresolved external symbol __imp__VariantInit@4 referenced in function "void __cdecl DisplayDeviceInformation(struct IEnumMoniker *)" (?DisplayDeviceInformation@@YAXPAUIEnumMoniker@@@Z)
test.obj : error LNK2019: unresolved external symbol __imp__CoUninitialize@0 referenced in function _main
test.obj : error LNK2019: unresolved external symbol __imp__CoInitializeEx@8 referenced in function _main

我正在使用 Windows 7 和 QT 5.0.2。

如有任何帮助,我们将不胜感激。

最佳答案

在谷歌上搜索“cocreateinstance unresolved external”并使用返回的第一个链接:

http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/5fc032e1-86d8-43c7-870b-f10599000605/

我发现了指示链接到 “ole32.lib” 的第三条评论。

您对我上面评论的回复表明 “oleAut32.lib” 也是必需的。

同时确保链接到 “strmiids.lib”

总而言之,需要的库是:

  • ole32.lib
  • oleaut32.lib
  • strmiids.lib

关于c++ - 使用系统设备枚举器选择捕获设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16675235/

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