title: Trying to resolve linker warning: defaultlib 'MSVCRT' conflicts with use of other libs
body: <p>I'm trying to resolve this common linker warning in my project, which loads a 3D model using Qt and Assimp. I'm using VS2008 and have compiled Qt5.1 and Assimp also with VS2008. I used the pre-compiled version of Boost (installed from boost_1_55_0-msvc-9.0-32.exe) I set Assimp to build for release win32. The C++ code generation is set to Multi-threaded DLL (/MD) and use assimp.lib in my project, which is set to Multi-threaded Debug DLL (/MDd). I'm not sure which library is causing the conflict. If I comment out the code in the cpp file that loads the model, the warning goes away.</p>
  
  <p>My library dependencies are: </p>
  
  <pre><code>qtmaind.lib Qt5Cored.lib Qt5Guid.lib Qt5Networkd.lib
  Qt5Widgetsd.lib Qt5OpenGLd.lib opengl32.lib glu32.lib assimp.lib
  </code></pre>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx</a></p>
  
  <p><a href="https://stackoverflow.com/questions/3007312/resolving-lnk4098-defaultlib-msvcrt-conflicts-with">Resolving LNK4098: defaultlib &#39;MSVCRT&#39; conflicts with </a></p>
  
  <p><a href="https://stackoverflow.com/questions/18612072/link-warning-lnk4098-defaultlib-msvcrt-conflicts-with-use-of-other-libs-us">LINK : warning LNK4098: defaultlib &#39;MSVCRT&#39; conflicts with use of other libs; use /NODEFAULTLIB:library</a></p>
  
  <pre><code>Creating library c:\Visual Studio 2008\Projects\qtdisplay\Win32\Debug\QuadPlanner.lib and object c:\Visual Studio 2008\Projects\qtdisplay\Win32\Debug\QuadPlanner.exp
  1&gt;LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
  
  
  1&gt;Linking...
  1&gt;Searching libraries
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\qtmaind.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Cored.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Guid.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Networkd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Widgetsd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5OpenGLd.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\opengl32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\glu32.lib:
  1&gt;    Searching c:\Visual Studio 2008\Projects\qtdisplay\qtdisplay\\..\lib\assimp.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprtd.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\MSVCRTD.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprt.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\MSVCRT.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\qtmaind.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Cored.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Guid.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Networkd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Widgetsd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5OpenGLd.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\opengl32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\glu32.lib:
  1&gt;    Searching c:\Visual Studio 2008\Projects\qtdisplay\qtdisplay\\..\lib\assimp.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprtd.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\MSVCRTD.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprt.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\MSVCRT.lib:
  1&gt;Finished searching libraries
  1&gt;   Creating library C:\Visual Studio 2008\Projects\qtdisplay\Win32\Debug\qtdisplay.lib and object C:\Visual Studio 2008\Projects\qtdisplay\Win32\Debug\qtdisplay.exp
  1&gt;Searching libraries
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\qtmaind.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Cored.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Guid.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Networkd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Widgetsd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5OpenGLd.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\opengl32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\glu32.lib:
  1&gt;    Searching c:\Visual Studio 2008\Projects\qtdisplay\qtdisplay\\..\lib\assimp.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprtd.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\MSVCRTD.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprt.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\MSVCRT.lib:
  1&gt;Finished searching libraries
  1&gt;LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
  1&gt;Searching libraries
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\qtmaind.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Cored.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Guid.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Networkd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Widgetsd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5OpenGLd.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\opengl32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\glu32.lib:
  1&gt;    Searching c:\Visual Studio 2008\Projects\qtdisplay\qtdisplay\\..\lib\assimp.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprtd.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\MSVCRTD.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprt.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\MSVCRT.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\qtmaind.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Cored.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Guid.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Networkd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5Widgetsd.lib:
  1&gt;    Searching C:\Qt\Qt5.1.1\lib\Qt5OpenGLd.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\opengl32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\glu32.lib:
  1&gt;    Searching c:\Visual Studio 2008\Projects\qtdisplay\qtdisplay\\..\lib\assimp.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
  1&gt;    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
  1&gt;    Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprtd.lib:
  1&gt;Finished searching libraries
  1&gt;Embedding manifest...
  1&gt;Build log was saved at "file://C:\Visual Studio 2008\Projects\qtdisplay\Win32\Debug\BuildLog.htm"
  1&gt;qtdisplay - 0 error(s), 1 warning(s)
  ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
  </code></pre>
  
  <p><strong>EDIT :</strong>
  I just built Assimp using the debug-noboost-st build configuration (/MDd), which resolved the warning (thanks, Laszlo). I didn't realize debug and release libraries should only be used with their respective build configurations and not mixed.</p>
  
  <p><a href="https://stackoverflow.com/questions/11658915/mixing-debug-and-release-library-binary-bad-practice">Mixing debug and release library/binary - bad practice?</a></p>
  
  <p>For future reference, I found these threads helpful:</p>
  
  <p>building boost from source:
  <a href="https://stackoverflow.com/questions/8204758/boost-compiling-with-msvc-11-vs-2012">Boost compiling with MSVC 11 (VS 2012)</a>
  <a href="https://stackoverflow.com/questions/8330302/trying-to-build-boost-i-cannot-get-bjam">Trying to build Boost: I cannot get bjam</a></p>
  
  <p>bjam toolset=msvc-9.0 variant=release,debug link=static,shared threading=multi install</p>
  
  <p>A co-worker mentioned that this particular error can also be caused if you mix libraries from before the visual studio service pack with the patched visual studio.</p>