Linker problems galore

LINK : fatal error LNK1104: cannot open file ‘mfcs42d.lib’

Go to Tools | Options… | Projects and Solutions | VC++ Directories, select Show Directories for: Library files and insert the path to your existing mfcs42d.lib.

Now you get
LNK2019: unresolved external symbol “public: __thiscall AFX_MODULE_STATE::AFX_MODULE_STATE(int,long (__stdcall*)(struct HWND__ *,unsigned int,unsigned int,long),unsigned long)” (??0AFX_MODULE_STATE@@QAE@HP6GJPAUHWND__@@IIJ@ZK@Z) referenced in function “public: __thiscall _AFX_DLL_MODULE_STATE::_AFX_DLL_MODULE_STATE(void)” (??0_AFX_DLL_MODULE_STATE@@QAE@XZ)

Remove mfcs42d.lib and you get
mfcs90d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)

Know what you did wrong?

I’ve got the answer.

Don’t link to mfcs42d (and, for that matter, the non-debug version mfcs42.lib) in your 2008 project. If that name’s hard-coded into your project – and it is, isn’t it? – then change the name to mfcs90d and you’ll be fine.

1 thought on “Linker problems galore

  1. Jim

    Another satisfied customer. Not being an old school C++ guy I was unwillingly put into the “unmanaged pit” and was getting that exact error. I changed my link to mfcs90d and it built fine. Thanks man!

Comments are closed.