Search code examples
c++visual-c++linkerlinker-warning

LNK4098 - How Dangerous Is It?


I use a 3rd party .lib file in my project. While our project builds well and seems to work well, I get this warning from the linker:

LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

My project is a .dll that uses Multi-threaded DLL Runtime Library (/MD option). We don't have a different version of the .lib file we can link.

  • How dangerous is this warning?
  • What are possible outcomes?
  • Our project works well in our office, should we expect unexpected crashes in real life?

Solution

  • If it builds correctly, you're fine.

    The danger is that libcmt defines some functions that are also defined by the other library you're using. In this case, you'll get errors (at link time) saying a symbol is multiply defined. If it builds without errors, though, the resulting executable should be fine.