Visual 2015链接错误与boost日志
Visual 2015 link error with boost log
我正在研究从VS'2008+Boost 1.144到VS'2015+Boost 1.61的源代码迁移,我得到了以下链接错误
... 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)
我使用:
bootstrap.bat
b2 --build-dir=build-directory toolset=msvc-14.0 --build-type=complete define=BOOST_LOG_NO_COMPILER_TLS stage
在源代码中,我使用BOOST_LOG_DYN_LINK
。似乎我使用的所有其他boost库都被找到并正确链接,但不是boost日志,只有这两个函数。
我注意到在boost/log/attributes/named_scoped.hpp
中,这两个函数被定义为named_scope
类的static member
(见下文)。我想知道这是不是联动问题的原因?因为我不确定静态函数可以从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;
我怀疑你的代码和Boost.Log之间的目标Windows API版本不匹配。
相关文章:
- boost日志文件无法创建sample.log文件
- 可视化如何在我的C++程序中最好地使用相同的Boost日志
- 使用cmake错误链接boost日志
- 磁盘已满时,Boost日志崩溃
- BOOST ::日志是每次运行应用程序时都可能旋转文件
- boost ::日志 - 使用库/插件内的独立严重性级别
- 使用boost ::日志配置文件变量
- 输出用户定义的结构使用boost ::日志
- Boost日志在链接到共享库时无法正常工作
- Boost日志链接器错误
- Boost日志:如何使用Boost_Log_GLOBAL_LOGGER_INIT指定同步接收器
- 为什么Boost日志记录器操作不是常量
- boost日志格式单一属性,带有logging::init_from_stream
- 避免Boost日志中的泄漏—琐碎的使用
- 使用boost日志,Valgrind检查内存泄漏
- 与Boost日志进行交叉编译链接期间未解决的符号
- Boost日志-为什么不编译
- 在项目中使用boost日志时出错
- 在OSX 10.7.2上使用boost 1.48的boost日志
- Boost日志不显示自定义时间戳