2013-05-21 48 views
1

我特林使用此鏈接: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 [email protected] referenced in function "long __cdecl EnumerateDevices(struct _GUID const &,struct IEnumMoniker * *)" ([email protected]@[email protected]@[email protected]@@Z) 
    test.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "void __cdecl DisplayDeviceInformation(struct IEnumMoniker *)" ([email protected]@[email protected]@@Z) 
    test.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "void __cdecl DisplayDeviceInformation(struct IEnumMoniker *)" ([email protected]@[email protected]@@Z) 
test.obj : error LNK2019: unresolved external symbol [email protected] referenced in function _main 
test.obj : error LNK2019: unresolved external symbol [email protected] referenced in function _main 

我使用Windows 7 & QT 5.0.2。

任何幫助將不勝感激感謝。

+0

的MSDN以上鍊接上的Visual Studio作品,但投QT – Jerry

+0

上的以下錯誤在本文的第一條評論:http://msdn.microsoft.com/en-us/library/dd407292(v=vs.85).aspx 它是指定的應用程序陽離子需要鏈接strmiids.lib,是你的情況爲QT版本? –

+0

我已經鏈接了lib「#pragma comment(lib,」strmiids「)」。 – Jerry

回答

2

搜索對谷歌「的CoCreateInstance無法解析的外部」,並使用第一個鏈接返回:

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
+1

一年半之後,此頁面是Google上的第一個鏈接:) –