Unresolved external symbols in Visual Studio 2010

20,625

Solution 1

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.

Solution 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.

Share:
20,625
Marc
Author by

Marc

Interactive installations specialist at We Choose Fun

Updated on December 29, 2020

Comments

  • Marc
    Marc over 3 years

    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

  • AJG85
    AJG85 about 13 years
    +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.
  • Marc
    Marc about 13 years
    Exactly what I did, but I'm still getting the errors. Something else must be wrong. Thanks anyway
  • eyeshield21
    eyeshield21 about 13 years
    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.