2

このリンクを使用しようとしていました: 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 を使用しています。

どんな助けでも感謝します。

4

1 に答える 1

3

Google で「cocreateinstance unresolved external」を検索し、返された最初のリンクを使用します。

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

"ole32.lib"に対してリンクすることを示す 3 番目のコメントを見つけました。

上記の私のコメントへの返信は、「oleAut32.lib」も必要であることを示しています。

また、必ず"strmiids.lib"に対してリンクしてください。

要約すると、必要なライブラリは次のとおりです。

  • ole32.lib
  • oleaut32.lib
  • strmiids.lib
于 2013-05-22T12:35:35.327 に答える