我有一個第三方DLL編譯與VC10(VS2010)。 它導出以下功能:LNK1120錯誤 - VS2012項目使用VS2010 DLL
bool myDLL_EXPORTS_API myFunction(std::vector<int>::const_iterator c)
{
return true;
}
我的EXE使用此DLL。我試圖用vc11編譯我的exe(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;
}
我得到下面的連接錯誤:
1>usingDLLvc10.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) bool __cdecl >myFunction(class std::_Vector_const_iterator > >)" (_imp[email protected]@[email protected][email protected]?>[email protected]@[email protected]@@[email protected]@@[email protected]@@Z) referenced in function _wmain 1>C:\Work\Training\vectorReproduceBug\usingDLLvc10\Debug\usingDLLvc10.exe : fatal error LNK1120: 1 >unresolved externals
注:此代碼編譯和鏈接,如果我的exe與VC10(VS2010)編譯。 如何解決此鏈接器錯誤,而沒有使用vc11(VS2012)編譯的第三方庫?