c++visual-studio-2012linker-warning

warning LNK4098: defaultlib 'mfc110u.lib' conflicts with use of other libs


Well, I get this warning when linking a lib which was compiled using an unicode character set while my project uses a multi-byte charset.

1>LINK : warning LNK4098: defaultlib 'mfc110u.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'mfcs110u.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

(Note, other libs like msvcrt etc. are not involved) My question is how to handle this issue. Can I simply ignore it or must I add /NODEFAULTLIB:lib (mfc110u.lib or mfc110.lib???) in any case?

Thanks in advance


Solution

  • There are several options available (same applied for similar warnings mixing debug/release libraries).

    1) Rebuild everything using same project specification, so either multi-byte or unicode in your case

    2) Leave everything as it is, but take care of data passed across your application and library which uses different runtime. So you dont pass anything to library which can be treated wrong based on other runtime. In case of debug/release issue that means for example that you dont free() or delete[] anything which was allocated in library and vice versa.. Same in your case if library expects any parameters being unicode you should take steps to provide proper strings to library functions.