I just created dll project in Visual Studio 2013:
New Project->MFC DLL->Next->Check "MFC Extention DLL" and finish.
Now, I add new class:
class CMyTest
{
public:
CMyTest();
~CMyTest();
int Test(){ return 1; }
};
Next, I compiled the project and got .lib,.dll files.
In the another project (who using the dll's) I just add the include,lib directory and copy the .dll file to the .exe file location and add the .lib file to Additional Dependency on Linker->Input.
Now, i just create some object from CMyTest class on my OnInitDialog() Method:
CMyTest x;
And when I tried to compiled the project I got Link error:
Error 3 error LNK2019: unresolved external symbol "public: __cdecl CMyTest::CMyTest(void)" (??0CMyTest@@QEAA@XZ) referenced in function "protected: virtual int __cdecl CUsingDllProjectDlg::OnInitDialog(void)" (?OnInitDialog@CUsingDllProjectDlg@@MEAAHXZ) C:\Users\user\documents\visual studio 2013\Projects\UsingDllProject\UsingDllProject\UsingDllProjectDlg.obj UsingDllProject
Error 4 error LNK2019: unresolved external symbol "public: __cdecl CMyTest::~CMyTest(void)" (??1CMyTest@@QEAA@XZ) referenced in function "protected: virtual int __cdecl CUsingDllProjectDlg::OnInitDialog(void)" (?OnInitDialog@CUsingDllProjectDlg@@MEAAHXZ) C:\Users\user\documents\visual studio 2013\Projects\UsingDllProject\UsingDllProject\UsingDllProjectDlg.obj UsingDllProject
Where is the problem?