error LNK2001: unresolved external symbol
I was asked to help out. At first I did not know why he got the linker errors. But I asked some questions to get to the root cause of the problem.
- Did he get a linker problem for all his functions?
- What was the new code accessed?
- What exactly does this specific linker error mean?
- What other info did the linker provide on the errors?
It appeared that the functions names in his new class were getting mangled. The new code was part of a DLL. He was trying to use the code in an EXE. I asked if he made the EXE depend on the DLL. He did so that was not the problem.
I recommended the developer look up exporting C++ classes from DLLs in the MSDN help. He did not have MSDN installed locally. And wouldn't you know it? He could not access MSDN online either. So we googled "DLL export classes". First hit was DLLs Made Simple.
After putting __declspec(dllexport) in front of the class declaration, the linker problems went away. Maybe using DLLs are really simple. Asking the right questions and getting good technical information can make hard problems seem easy in the end.