Opened 8 years ago
Closed 8 years ago
#10023 closed Bugs (worksforme)
using boost::log in shared runtime application
Reported by: | Owned by: | Andrey Semashev | |
---|---|---|---|
Milestone: | Boost 1.56.0 | Component: | log |
Version: | Boost 1.55.0 | Severity: | Showstopper |
Keywords: | Cc: | scdev92@… |
Description
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!
I also tested it with version 1.46.1. It was also not possible there.
My source is:
[...] typedef boost::log::sinks::synchronous_sink<boost::log::sinks::text_ostream_backend > text_sink; boost::shared_ptr< text_sink > sink( new text_sink ); [...]
My errors are:
[...] 1> Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_thread-vc100-mt-gd-1_46_1.lib: 1> Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_date_time-vc100-mt-gd-1_46_1.lib: 1> Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_filesystem-vc100-mt-gd-1_46_1.lib: 1> Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_system-vc100-mt-gd-1_46_1.lib: 1> Searching D:\work\work_3rdparty/boost_1_46_1/stage/win7x64vs10\libboost_log-vc100-mt-gd-1_46_1.lib: 1> Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\LIBCMTD.lib: 1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::exception::exception(void)" (??0exception@std@@QEAA@XZ) already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::exception::exception(char const * const &)" (??0exception@std@@QEAA@AEBQEBD@Z) already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::exception::exception(char const * const &,int)" (??0exception@std@@QEAA@AEBQEBDH@Z) already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::exception::exception(class std::exception const &)" (??0exception@std@@QEAA@AEBV01@@Z) already defined in MSVCRTD.lib(MSVCR100D.dll) 1>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>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>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>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __cdecl std::bad_cast::bad_cast(class std::bad_cast const &)" (??0bad_cast@std@@QEAA@AEBV01@@Z) already defined in MSVCRTD.lib(MSVCR100D.dll) 1>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>LIBCMTD.lib(invarg.obj) : error LNK2005: _invalid_parameter already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(mlock.obj) : error LNK2005: _lock already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(mlock.obj) : error LNK2005: _unlock already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(atox.obj) : error LNK2005: atoi already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: exit already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _cexit already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _amsg_exit already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _initterm_e already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(dosmap.obj) : error LNK2005: _errno already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(sprintf.obj) : error LNK2005: sprintf already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(crt0init.obj) : error LNK2005: __xi_a already defined in MSVCRTD.lib(cinitexe.obj) 1>LIBCMTD.lib(crt0init.obj) : error LNK2005: __xi_z already defined in MSVCRTD.lib(cinitexe.obj) 1>LIBCMTD.lib(crt0init.obj) : error LNK2005: __xc_a already defined in MSVCRTD.lib(cinitexe.obj) 1>LIBCMTD.lib(crt0init.obj) : error LNK2005: __xc_z already defined in MSVCRTD.lib(cinitexe.obj) 1>LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(crt0.obj) : error LNK2005: mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj) 1>LIBCMTD.lib(errmode.obj) : error LNK2005: __set_app_type already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(winxfltr.obj) : error LNK2005: _XcptFilter already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(setlocal.obj) : error LNK2005: _configthreadlocale already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(dbgrptw.obj) : error LNK2005: _CrtDbgReportW already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(_file.obj) : error LNK2005: _lock_file already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(_file.obj) : error LNK2005: _unlock_file already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(printf.obj) : error LNK2005: printf already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(fflush.obj) : error LNK2005: fflush already defined in MSVCRTD.lib(MSVCR100D.dll) 1>LIBCMTD.lib(tolower.obj) : error LNK2005: tolower already defined in MSVCRTD.lib(MSVCR100D.dll) [...]
Change History (2)
comment:1 by , 8 years ago
- 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.
- 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.
- 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.
comment:2 by , 8 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.