未解决的外部符号2010

问题描述:

我从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

如果这太过于迂腐,请道歉。如果这是一个预建图书馆(未建成的项目/解决方案的一部分),那么要确保

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

在属性页为您的项目中,导航到配置>链接>输入和的lib文件添加到附加依赖设置。这适用于VC++ 2008,可能与2010年相同。