2
votes

I have a third party DLL compiled with vc10 (VS2010). It exports the following function:

bool myDLL_EXPORTS_API myFunction(std::vector<int>::const_iterator c)
{
return true;
}

My exe uses this DLL. I am trying to compile my exe with vc11 (vs2012).

#include "stdafx.h"
#include <vector>
#include "myDll_VC10\myDll_VC10.h"

int _tmain(int argc, _TCHAR* argv[])
{
    std::vector<int>::const_iterator c;
    myFunction(c);

    return 0;   
}

I get the following linker error:

1>usingDLLvc10.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) bool __cdecl >myFunction(class std::_Vector_const_iterator > >)" (_imp?myFunction@@YA_NV?$_Vector_const_iterator@V?$_Vector_val@U?>$_Simple_types@H@std@@@std@@@std@@@Z) referenced in function _wmain 1>C:\Work\Training\vectorReproduceBug\usingDLLvc10\Debug\usingDLLvc10.exe : fatal error LNK1120: 1 >unresolved externals

Note: This code compiles and links if my exe is compiled with vc10 (VS2010). How do I fix this linker error without the third party library compiled with vc11 (VS2012)?

1

1 Answers

4
votes

You basically can't. The compiled binaries are different based on which compiler you used to compile it, so DLL's generated by vs2010 are not compatible with vs2012. The only way to fix this is to re-compile your old 2010 library from its source to a 2012 version.