title: Conflicting Runtime Libraries in MSVC/VS2012
body: <p>I know: <a href="https://stackoverflow.com/questions/3007312/resolving-lnk4098-defaultlib-msvcrt-conflicts-with">this has already been addressed</a>, but after reading as much as I could about this I still haven't been able to figure out why I haven't been able to fix it, or <em>what</em> to fix even.</p>
  
  <p>You see, according to <a href="http://msdn.microsoft.com/en-us/library/abx4dbyh%28v=vs.80%29.aspx" rel="nofollow noreferrer">this</a>, there will be issues if your project is using two different standard run-time libraries for compilation at the same time. The most common of these appear to be <strong>libcmt.lib</strong> and <strong>msvcrt.lib</strong>, along with their debugging equivalents.</p>
  
  <p>Apparently, my project is using <strong>both</strong> of these, hence the following warnings which appear together:</p>
  
  <pre><code>1&gt;LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
  1&gt;LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
  1&gt;glew32s.lib(glew.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'glew32s.lib(glew.obj)' or at 'C:\Programming\VS\Play_VS\Debug\vc100.pdb'; linking object as if no debug info
  </code></pre>
  
  <p>As you can see, I'm using glew for this. The code compiles without any errors, but the fact that the only external libraries I'm using are <strong>GLEW/GLFW/GLU/GLM</strong> makes me wonder if there is any configuration issues which might reside in my current build. I'm not using MFC or ATL or any other Visual C++ library apart from their native STL implementation.</p>
  
  <p>First off, I'll say that I've tried setting my project's properties from <code>Multi-Threaded [Debug] DLL</code> to <code>Multi-Threaded [Debug]</code>, which seems to make things worse by producing the following output:</p>
  
  <pre><code>1&gt;MSVCRT.lib(MSVCR110.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)
  1&gt;MSVCRT.lib(MSVCR110.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgmalloc.obj)
  1&gt;MSVCRT.lib(MSVCR110.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj)
  1&gt;MSVCRT.lib(MSVCR110.dll) : error LNK2005: ___iob_func already defined in LIBCMTD.lib(_file.obj)
  1&gt;MSVCRT.lib(MSVCR110.dll) : error LNK2005: _strchr already defined in LIBCMTD.lib(strchr.obj)
  1&gt;MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &amp;)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
  1&gt;MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info &amp; __thiscall type_info::operator=(class type_info const &amp;)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
  1&gt;LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
  1&gt;LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
  1&gt;C:\Programming\VS\Play_VS\Debug\Play_VS.exe : fatal error LNK1169: one or more multiply defined symbols found
  </code></pre>
  
  <p>Likewise, looking through my compilation flags for both Debug and Release builds tells me that <code>/MT</code> (libcmt.lib) does not exist in either of the command generation inputs. As far as I know, most people writing native C++ applications in windows use <code>/MD</code>, i.e. <code>msvcrt.lib</code>.</p>
  
  <p><strong>Debug Build Input</strong> </p>
  
  <pre><code>/GS /analyze- /W3 /Zc:wchar_t /ZI /Gm /Od /Fd"Debug\vc110.pdb" /fp:precise /D "GLEW_STATIC" /D "_CRT_SECURE_NO_WARNINGS" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /RTC1 /GR /Gd /Oy- /MDd /Fa"Debug\" /EHsc /nologo /Fo"Debug\" /Fp"Debug\Play_VS.pch" 
  </code></pre>
  
  <p><strong>Release Build Input</strong></p>
  
  <pre><code>/GS /GL /analyze- /W3 /Gy /Zc:wchar_t /Zi /Gm- /O2 /Fd"Release\vc110.pdb" /fp:precise /D "_CRT_SECURE_NO_WARNINGS" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MD /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\Play_VS.pch" 
  </code></pre>
  
  <p>How can I fix this? I appreciate the help.</p>