0

I'm trying to compile my project with a third party library, using Visual Studio 2008. Now the thing is that I added the lib file to LINKER input, updated the additional library locations - made sure that the lib file is indeed read (removed the additional location and compilation failed, screaming that lib file was not found). I checked the exports present in the lib with dumpbin and the functionality is present.

Yet I'm still getting Error LINK2019 unresolved bla bla bla when calling the functions from that library. Anyone faced anything similar/has any idea? Maybe its worth saying that it seems that the library I'm trying to use was compiled using VS2003.

Update: definition as appears in library header:

#ifndef X
#define X

#ifdef _cplusplus
extern "C" {
#endif

_XFUNC int X_Open(int C);

#ifdef _cplusplus
}
#endif
#endif

And the definition of export: (in another header included in the library header)

#ifdef _BUILDXDLL
    #define _XFUNC __declspec (dllexport)
#else
    #ifdef WIN32
        #define _XFUNC __declspec (dllimport)
    #else
        #define _XFUNC
    #endif
#endif

Full Error Message:

error LNK2019: unresolved external symbol _X_Open referenced in function "public virtual bool __thiscall MyClass::initialise(class QDomElement*)"(?initialise@MyClass@@UAE_NPAV QDomElement @@@Z)

I'm not sure if it's relevant, but the declaration is *X_Open* and in the error message it appears as *_X_Open* Thanks in advance, Anorflame

Anorflame
  • 376
  • 3
  • 12
  • Please add the full error message for at least one function and the corresponding declaration from the header file to your question. That could help find the cause. – Codo Jul 17 '12 at 16:41

1 Answers1

0

A Breakthrough! The problem was in calling convention. My project was set to __cdecl(/Gd) while the 3rd party library was compiled using __stdcall(/Gz) (which explains by the way why the linker concatenated an _ to X_Open).

This takes my to another problem - but that's already another question.

Anorflame
  • 376
  • 3
  • 12