Boost C++ Libraries: Ticket #10023: using boost::log in shared runtime application https://svn.boost.org/trac10/ticket/10023 <p> It is not possible to use boost::log in a shared runtime application (/MDd or /MD), only in a static runtime application (/MTd or /MT). I cannot modify my application due to some other libraries. All the other boost stuff e.g. threads, condition vars, ... works! But not log! </p> <p> I also tested it with version 1.46.1. It was also not possible there. </p> <p> My source is: </p> <pre class="wiki">[...] typedef boost::log::sinks::synchronous_sink&lt;boost::log::sinks::text_ostream_backend &gt; text_sink; boost::shared_ptr&lt; text_sink &gt; sink( new text_sink ); [...] </pre><p> My errors are: </p> <pre class="wiki">[...] 1&gt; Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_thread-vc100-mt-gd-1_46_1.lib: 1&gt; Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_date_time-vc100-mt-gd-1_46_1.lib: 1&gt; Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_filesystem-vc100-mt-gd-1_46_1.lib: 1&gt; Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_system-vc100-mt-gd-1_46_1.lib: 1&gt; Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_log-vc100-mt-gd-1_46_1.lib: 1&gt; Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\LIBCMTD.lib: 1&gt;LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::exception::exception(void)" (??0exception@std@@QEAA@XZ) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::exception::exception(char const * const &amp;)" (??0exception@std@@QEAA@AEBQEBD@Z) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::exception::exception(char const * const &amp;,int)" (??0exception@std@@QEAA@AEBQEBDH@Z) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::exception::exception(class std::exception const &amp;)" (??0exception@std@@QEAA@AEBV01@@Z) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __cdecl std::exception::~exception(void)" (??1exception@std@@UEAA@XZ) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const * __cdecl std::exception::what(void)const " (?what@exception@std@@UEBAPEBDXZ) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::bad_cast::bad_cast(char const *)" (??0bad_cast@std@@QEAA@PEBD@Z) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::bad_cast::bad_cast(class std::bad_cast const &amp;)" (??0bad_cast@std@@QEAA@AEBV01@@Z) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __cdecl std::bad_cast::~bad_cast(void)" (??1bad_cast@std@@UEAA@XZ) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(invarg.obj) : error LNK2005: _invalid_parameter already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(dbgheap.obj) : error LNK2005: _CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(mlock.obj) : error LNK2005: _lock already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(mlock.obj) : error LNK2005: _unlock already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(atox.obj) : error LNK2005: atoi already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(crt0dat.obj) : error LNK2005: exit already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(crt0dat.obj) : error LNK2005: _cexit already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(crt0dat.obj) : error LNK2005: _amsg_exit already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(crt0dat.obj) : error LNK2005: _initterm_e already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(dosmap.obj) : error LNK2005: _errno already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(sprintf.obj) : error LNK2005: sprintf already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(crt0init.obj) : error LNK2005: __xi_a already defined in MSVCRTD.lib(cinitexe.obj) 1&gt;LIBCMTD.lib(crt0init.obj) : error LNK2005: __xi_z already defined in MSVCRTD.lib(cinitexe.obj) 1&gt;LIBCMTD.lib(crt0init.obj) : error LNK2005: __xc_a already defined in MSVCRTD.lib(cinitexe.obj) 1&gt;LIBCMTD.lib(crt0init.obj) : error LNK2005: __xc_z already defined in MSVCRTD.lib(cinitexe.obj) 1&gt;LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(crt0.obj) : error LNK2005: mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj) 1&gt;LIBCMTD.lib(errmode.obj) : error LNK2005: __set_app_type already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(winxfltr.obj) : error LNK2005: _XcptFilter already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(setlocal.obj) : error LNK2005: _configthreadlocale already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(dbgrptw.obj) : error LNK2005: _CrtDbgReportW already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(_file.obj) : error LNK2005: _lock_file already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(_file.obj) : error LNK2005: _unlock_file already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(printf.obj) : error LNK2005: printf already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(fflush.obj) : error LNK2005: fflush already defined in MSVCRTD.lib(MSVCR100D.dll) 1&gt;LIBCMTD.lib(tolower.obj) : error LNK2005: tolower already defined in MSVCRTD.lib(MSVCR100D.dll) [...] </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10023 Trac 1.4.3 Andrey Semashev Thu, 08 May 2014 15:59:03 GMT <link>https://svn.boost.org/trac10/ticket/10023#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10023#comment:1</guid> <description> <ol><li>Boost.Log only appeared in Boost since 1.54. I don't think Boost.Log from 1.54 or later is compatible with 1.46. If you're using some pre-release version, please specify which. </li><li>There is nothing in Boost.Log preventing it from being used with shared runtime. In fact, I think, this is the default when you build shared libs. </li><li>My guess is that your build is inconsistent. It's difficult to say how exactly, but you probably have some libraries built with shared runtime and others with static. You should not mix those libraries, it won't work. Try rebuilding everything with "runtime-link=shared" bjam option. </li></ol> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Wed, 11 Jun 2014 18:42:08 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10023#comment:2 https://svn.boost.org/trac10/ticket/10023#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> Ticket