I am trying following link to call dll function from a exe project in C++. In step 7 when I include the dll's lib file in the exe project through
TestExeProject->Properties->Linker->AdditionalLibraryDirectories, I am unable to compile the exe project. I am getting the following link error,
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall CTest::CTest(void)" (__imp_??0CTest@@QAE@XZ) referenced in function "protected: virtual int __thiscall CTestExeDlg::OnInitDialog(void)" (?OnInitDialog@CTestExeDlg@@MAEHXZ)
Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl fnTest(void)" (__imp_?fnTest@@YAHXZ) referenced in function "protected: virtual int __thiscall CTestExeDlg::OnInitDialog(void)" (?OnInitDialog@CTestExeDlg@@MAEHXZ)
The following issue I resolved by adding
#pragma comment(lib, "C:\\Users\\abc\\Documents\\Visual Studio 2010\\Projects\\Test\\Debug\\Test.lib")
But how to resolve this without adding this line but from the project properties?