I'm working on a source code migration from VS'2008+Boost 1.144 to VS'2015+Boost 1.61 and I got the following link error
... error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl boost::log::v2_mt_nt5::attributes::named_scope::push_scope(struct boost::log::v2_mt_nt5::attributes::named_scope_entry const &)" (__imp_?push_scope@named_scope@attributes@v2_mt_nt5@log@boost@@SAXABUnamed_scope_entry@2345@@Z) referenced in function "public: __thiscall boost::log::v2_mt_nt5::attributes::named_scope::sentry::sentry(class boost::log::v2_mt_nt5::basic_string_literal<char,struct std::char_traits<char> > const &,class boost::log::v2_mt_nt5::basic_string_literal<char,struct std::char_traits<char> > const &,unsigned int,enum boost::log::v2_mt_nt5::attributes::named_scope_entry::scope_name_type)" (??0sentry@named_scope@attributes@v2_mt_nt5@log@boost@@QAE@ABV?$basic_string_literal@DU?$char_traits@D@std@@@345@0IW4scope_name_type@named_scope_entry@2345@@Z)
... : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl boost::log::v2_mt_nt5::attributes::named_scope::pop_scope(void)" (__imp_?pop_scope@named_scope@attributes@v2_mt_nt5@log@boost@@SAXXZ) referenced in function "public: __thiscall boost::log::v2_mt_nt5::attributes::named_scope::sentry::~sentry(void)" (??1sentry@named_scope@attributes@v2_mt_nt5@log@boost@@QAE@XZ)
To build boost I used :
bootstrap.bat
b2 --build-dir=build-directory toolset=msvc-14.0 --build-type=complete define=BOOST_LOG_NO_COMPILER_TLS stage
And in source code I used BOOST_LOG_DYN_LINK
. It seems that all the other boost lib I'm using are found and linked correctly but not boost log and only those 2 functions.
I noticed that in boost/log/attributes/named_scoped.hpp
those 2 functions are defined as static member
of the named_scope
class (see below). And I'm wondering if it could be the reason of that linkage issue ? Because I'm not sure that a static function can be exported/loaded from a dll !
/*!
* The method pushes the scope to the back of the current thread's scope list
*
* \b Throws: Nothing.
*/
static void push_scope(scope_entry const& entry) BOOST_NOEXCEPT;
/*!
* The method pops the last pushed scope from the current thread's scope list
*
* \b Throws: Nothing.
*/
static void pop_scope() BOOST_NOEXCEPT;
Any idea or advice to fix that problem would be welcome.