2011-04-22 105 views
5

我從Xcode中來,試圖編譯在Visual Studio 2010中的一個項目,我也得到了以下錯誤:未解決的外部符號2010

2>ofxCLeye.obj : error LNK2019: unresolved external symbol "struct _GUID __cdecl CLEyeGetCameraUUID(int)" ([email protected]@[email protected]@[email protected]) referenced in function "public: static int __cdecl ofxCLeye::listDevices(void)" ([email protected]@@SAHXZ) 
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "int __cdecl CLEyeGetCameraCount(void)" ([email protected]@YAHXZ) referenced in function "public: static int __cdecl ofxCLeye::listDevices(void)" ([email protected]@@SAHXZ) 
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraGetFrameDimensions(void *,int &,int &)" ([email protected]@[email protected]) referenced in function "public: void __thiscall ofxCLeye::grabFrame(void)" ([email protected]@@QAEXXZ) 
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraGetFrame(void *,unsigned char *,int)" ([email protected]@[email protected]) referenced in function "public: void __thiscall ofxCLeye::grabFrame(void)" ([email protected]@@QAEXXZ) 
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeDestroyCamera(void *)" ([email protected]@[email protected]) referenced in function "public: virtual void __thiscall ofxCLeye::close(void)" ([email protected]@@UAEXXZ) 
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraStop(void *)" ([email protected]@[email protected]) referenced in function "public: virtual void __thiscall ofxCLeye::close(void)" ([email protected]@@UAEXXZ) 
... etc etc... 
2>bin\clEye_debug.exe : fatal error LNK1120: 10 unresolved externals 

我想,編譯器試圖鏈接CLEyeMulticam.lib但沒有找到它。我認爲我已經正確配置了它。

你能否指點我需要的步驟來在VS2010中包含一個庫?

謝謝

馬克

+0

「CLEyeMulticam.lib」文件是否存在或應該由VS2010構建? – quamrana 2011-04-22 15:38:53

回答

10

如果這太過於迂腐,請道歉。如果這是一個預建圖書館(未建成的項目/解決方案的一部分),那麼要確保

a) #include the correct header 
b) #define any requisite macros 
c) speciy additional .lib dependencies as shown below. 

enter image description here

你需要指定一個完全組隊參加道路(d:\ SRC \ project \ libs \ camera.lib),除非該庫文件位於LIB環境變量中。

+0

+1:但是如果您將libs目錄添加到其他包含目錄,添加具有屬性表的路徑,添加具有環境變量的路徑或使用項目目錄中的相對路徑,則路徑不需要完全限定。 – AJG85 2011-04-22 15:52:32

+0

正是我所做的,但我仍然收到錯誤。其他的一定是錯的。無論如何感謝 – Marc 2011-04-22 16:42:50

+1

Marc,庫是否導出C或C++接口?如果您試圖使用C++代碼鏈接'C'庫(我猜是API名稱的情況),那麼名稱修改會導致鏈接錯誤。在庫頭文件中,檢查所有庫函數是否包含在extern「C」{}塊中。 – 2011-04-26 14:47:52

2

在屬性頁爲您的項目中,導航到配置>鏈接>輸入和的lib文件添加到附加依賴設置。這適用於VC++ 2008,可能與2010年相同。