VS2015下 boost log 无法链接(真正解决问题)
在VS2015下编译基于Boost log库的trivial例子时,编译器报出错误信息:
2>logtrivial_test1.obj : error LNK2019: 无法解析的外部符号 "public: static void __cdecl boost::log::v2s_mt_nt6::record_view::public_data::destroy(struct boost::log::v2s_mt_nt6::record_view::public_data const *)" (?destroy@public_data@record_view@v2s_mt_nt6@log@boost@@SAXPBU12345@@Z),该符号在函数 "public: void __thiscall boost::log::v2s_mt_nt6::record::reset(void)" (?reset@record@v2s_mt_nt6@log@boost@@QAEXXZ) 中被引用
2>logtrivial_test1.obj : error LNK2019: 无法解析的外部符号 "public: bool __thiscall boost::log::v2s_mt_nt6::core::get_logging_enabled(void)const " (?get_logging_enabled@core@v2s_mt_nt6@log@boost@@QBE_NXZ),该符号在函数 "public: class boost::log::v2s_mt_nt6::record __thiscall boost::log::v2s_mt_nt6::sources::basic_composite_logger<char,class boost::log::v2s_mt_nt6::sources::severity_logger_mt<enum boost::log::v2s_mt_nt6::trivial::severity_level>,struct boost::log::v2s_mt_nt6::sources::multi_thread_model<class boost::log::v2s_mt_nt6::aux::light_rw_mutex>,struct boost::log::v2s_mt_nt6::sources::features<struct boost::log::v2s_mt_nt6::sources::severity<enum boost::log::v2s_mt_nt6::trivial::severity_level> > >::open_record<struct boost::parameter::aux::tagged_argument<struct boost::log::v2s_mt_nt6::keywords::tag::se

在Visual Studio 2015中使用Boost Log时遇到编译错误。尝试修改boost/detail/winapi/config.hpp文件设置BOOST_USE_WINAPI_VERSION无效。正确解决方案是在bjam命令行添加定义,并在项目中包含额外的预处理器定义,从而成功解决链接问题。
最低0.47元/天 解锁文章
2145

被折叠的 条评论
为什么被折叠?



