When linking my dll in release build I get –
1>LINK : warning LNK4098: defaultlib
‘mfc80d.lib’ conflicts with use of
other libs; use /NODEFAULTLIB:library1>LINK : warning LNK4098: defaultlib
‘mfcs80d.lib’ conflicts with use of
other libs; use /NODEFAULTLIB:library1>LINK : warning LNK4098: defaultlib
‘msvcrtd.lib’ conflicts with use of
other libs; use /NODEFAULTLIB:library
adding /VERBOSE, I see the following (snippet):
…
1> Searching D:\Microsoft Visual
Studio 8\VC\atlmfc\lib\mfc80d.lib:1>
Found “public: virtual __thiscall
AFX_MODULE_STATE::~AFX_MODULE_STATE(void)”
(??1AFX_MODULE_STATE@@UAE@XZ) 1>
Referenced in mfcs80.lib(dllmodul.obj)
1> Loaded
mfc80d.lib(MFC80D.DLL)1> Found “long stdcall
AfxWndProc(struct HWND__ *,unsigned
int,unsigned int,long)”
(?AfxWndProc@@YGJPAUHWND__@@IIJ@Z)1>
Referenced in mfcs80.lib(dllmodul.obj)
1> Loaded
mfc80d.lib(MFC80D.DLL)…
If I’m interpreting this correctly, it means the linker somehow resolves calls from the (optimized) library mfcs80, as calls into the (non-optimized) library mfc80D. How can this be??
When I add /NODEFAULTLIB:mfc80d.lib the warnings are gone, but I’m not quiet with it yet. As an aside, the module does indeed suffer from sporadic inexplicable crashes on incremental links, that are solved only by a re-build. I’m using VS2005.
[Edit:] Changed the title to include DEFAULTLIB, hopefully better focusing the subject. I do see an explicit line saying
processed /DEFAULTLIB:mfc80d.lib
in the /VERBOSE output, among many other (non-debug) default libs. Where does it come from? how can I fix this?
Thanks!
The issue was resolved much later – I post it up here in case it helps somebody someday.
It turned out to be a wrong precompiled header path: release configuration pointed to the default debug PCH path. So on transition from debug to release, a build would drag in all the debug PCH contents – apparently including some debug versions of MFC #pragma (comment “lib..”) (included in afx headers). A clean build would rebuild the PCH correctly, but again into the debug folder – thereby causing identical problems on transition back to debug build.