Tae-Sung Shin
Tae-Sung Shin

Reputation: 20633

LNK4098: defaultlib "mfc42d.lib" conflicts in Release build

After several hours of stretching my hairs, I can't figure this out. In Debug version, it is working fine. But in release mode, I am getting this warnings and eventually an runtime error. As far as I know, these libraries are debug versions. Why is my release build looking for these libraries and how can I stop it? FYI, I looked at settings and project files to find a clue in vain.

 LINK : warning LNK4098: defaultlib "mfc42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
 LINK : warning LNK4098: defaultlib "mfcs42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
 LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library

Upvotes: 0

Views: 1291

Answers (1)

the_mandrill
the_mandrill

Reputation: 30832

Impossible to tell without more information why your project is including these. My guess is that you are linking with a debug configuration of some other library, which is pulling in those dependencies. If you increase the verbosity of the linker settings then it may show you which files are including them.

The fix though is given in the error message. Add /nodefaultlib:mfc42d.lib/nodefaultlib:mfcs42d.lib /nodefaultlib:msvcrtd.lib to the linker arguments.

Upvotes: 1

Related Questions