Unresolved external symbols in Visual Studio 2010
Asked Answered
D

2

5

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

Deedeeann answered 22/4, 2011 at 15:34 Comment(1)
Is CLEyeMulticam.lib a file you have lying around or should it have been built by VS2010?Albina
W
10

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.

Weismannism answered 22/4, 2011 at 15:43 Comment(3)
+1: but the path does not need to be fully qualified if you add your libs directory to Additional Include Directories, add the path with property sheets, add path with environment variable, or use relative paths from your project directory.Scan
Exactly what I did, but I'm still getting the errors. Something else must be wrong. Thanks anywayDeedeeann
Marc, does the library export a C or a C++ interface? If you are trying to link a 'C' library (which i'm guessing is the case from the API names) with C++ code, then name-mangling is causing the link errors. In the library header file check that all library funcitons are enclosed in an extern "C" { } block.Weismannism
C
2

In the Property Pages for your project, navigate to Configuration > Linker > Input and add the lib file to the Additional Dependencies setting. This applies to VC++ 2008, probably likewise to 2010.

Codon answered 22/4, 2011 at 15:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.