I have two projects, the dependency library "DEP", and the caller "test.exe". DEP is compiled to DLL with an import library, while "test.exe" links to the "DEP.lib".
In DEP, I have classes like: class __declspec(dllexport) C; class A : public C; class B : public C;
Later, I make A and B public in the "DEP.dll" using __declspec(dllexport) to decorate them.
Although "test.exe" can uses A and its ctors and member functions, whenever "test.exe" uses ctors and member functions of B, VC compiler would complain about "unresolved external symbols".
In order to deal with this, I made several tries:
Open "DEP.dll" with "depends.exe", and I saw symbols of B start with "?B**" ("*" means arbitrary characters)
Open "DEP.lib" with "dumpbin.exe", and I saw again, symbols of B start with "?B**"
I checked errors of compiler, it said "error LNK2019: unresolved external symbols __declspec(dllimport) public: _thiscall B::B(void)", and corresponding symbols start with "_imp_?B**". So, I doubt whether it is a dismatch of symbols.
Then, I removed "DEP.lib" from "test.exe"'s reference to see what are the symbols of A like. As a result, I saw A also start with "_imp?*A*" while in "DEP.dll", A's start with "?A". That means it did match!
I rebuilt my DEP project to rebuilt ".obj" files, yet, it did not work.
Does anyone know what is this problem? Thank you!