Unresolved external symbols in Visual Studio 2010

Marc picture Marc · Apr 22, 2011 · Viewed 20.5k times · Source

I am coming from Xcode, trying to compile a project in Visual Studio 2010, and I get the following errors:

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

I imagine that the compiler is trying to link CLEyeMulticam.lib but not finding it. I think that I have configured it properly.

Could you point me with the needed steps to include a library in VS2010 ?

Thank you,

marc

Answer

J Evans picture J Evans · Apr 22, 2011

Apologies if this is overly pedantic. If this is a pre-built library (not built as part of the project/solution) then make sure you

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

enter image description here

You will need to specify a fully qualifed path (d:\src\project\libs\camera.lib) unless the libary file is in the LIB environment variable.