LNK1120 error - VS2012 project using a VS2010 DLL

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


1
2
3
4
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).

1
2
3
4
5
6
7
8
9
10
11
#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<class std::_Vector_val<struct std::_Simple_types<int> > >)" (__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)?


AFAIK it can't be done. The lib has to be rebuilt with 2012.

Part of the reason why I hate dynamically linking on Windows.

EDIT: fixed "had"->"hate". Now it actually makes sense.
Last edited on
Thank you
Topic archived. No new replies allowed.