Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3021

LNK1120 error - VS2012 project using a VS2010 DLL

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

Code:

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).
Code:

#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)?

Viewing all articles
Browse latest Browse all 3021