boost log库链接问题

1. 使用动态库时,要定义 BOOST_LOG_DYN_LINK  或者 BOOST_ALL_DYN_LINK

否则会出现如下错误:

CMakeFiles/IrcChatData.dir/src/main.cpp.o: In function `boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::logger, boost::log::v2s_mt_posix::sources::single_thread_model>::~basic_logger()':
/usr/local/boost/include/boost/log/sources/basic_logger.hpp:79: undefined reference to `boost::log::v2s_mt_posix::attribute_set::~attribute_set()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `config::init_logging(boost::asio::io_context&)':
/root/projects/IrcChatData/src/config.cpp:74: undefined reference to `boost::log::v2s_mt_posix::core::get()'
/root/projects/IrcChatData/src/config.cpp:74: undefined reference to `boost::log::v2s_mt_posix::core::add_sink(boost::shared_ptr<boost::log::v2s_mt_posix::sinks::sink> const&)'
/root/projects/IrcChatData/src/config.cpp:77: undefined reference to `boost::log::v2s_mt_posix::core::get()'
/root/projects/IrcChatData/src/config.cpp:77: undefined reference to `boost::log::v2s_mt_posix::core::set_filter(boost::log::v2s_mt_posix::filter const&)'
/root/projects/IrcChatData/src/config.cpp:81: undefined reference to `boost::log::v2s_mt_posix::core::get()'
/root/projects/IrcChatData/src/config.cpp:81: undefined reference to `boost::log::v2s_mt_posix::core::add_sink(boost::shared_ptr<boost::log::v2s_mt_posix::sinks::sink> const&)'
/root/projects/IrcChatData/src/config.cpp:83: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
/root/projects/IrcChatData/src/config.cpp:83: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `config::rotate_log(boost::system::error_code const&, int)':
/root/projects/IrcChatData/src/config.cpp:91: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
/root/projects/IrcChatData/src/config.cpp:91: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
/root/projects/IrcChatData/src/config.cpp:94: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o:/root/projects/IrcChatData/src/config.cpp:94: more undefined references to `boost::log::v2s_mt_posix::trivial::logger::get()' follow
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `config::rotate_log(boost::system::error_code const&, int)':
/root/projects/IrcChatData/src/config.cpp:95: undefined reference to `boost::log::v2s_mt_posix::sinks::text_file_backend::rotate_file()'
/root/projects/IrcChatData/src/config.cpp:96: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
/root/projects/IrcChatData/src/config.cpp:96: undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::attribute_name::attribute_name(char const*)':
/usr/local/boost/include/boost/log/attributes/attribute_name.hpp:80: undefined reference to `boost::log::v2s_mt_posix::attribute_name::get_id_from_string(char const*)'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::attribute::impl::~impl()':
/usr/local/boost/include/boost/log/attributes/attribute.hpp:75: undefined reference to `boost::log::v2s_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::attribute::impl::~impl()':
/usr/local/boost/include/boost/log/attributes/attribute.hpp:75: undefined reference to `boost::log::v2s_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::intrusive_ptr_release(boost::log::v2s_mt_posix::record_view::public_data const*)':
/usr/local/boost/include/boost/log/core/record_view.hpp:93: undefined reference to `boost::log::v2s_mt_posix::record_view::public_data::destroy(boost::log::v2s_mt_posix::record_view::public_data const*)'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::record::reset()':
/usr/local/boost/include/boost/log/core/record.hpp:157: undefined reference to `boost::log::v2s_mt_posix::record_view::public_data::destroy(boost::log::v2s_mt_posix::record_view::public_data const*)'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::aux::once_block_sentry::~once_block_sentry()':
/usr/local/boost/include/boost/log/utility/once_block.hpp:86: undefined reference to `boost::log::v2s_mt_posix::aux::once_block_sentry::rollback()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::aux::once_block_sentry::executed() const':
/usr/local/boost/include/boost/log/utility/once_block.hpp:91: undefined reference to `boost::log::v2s_mt_posix::aux::once_block_sentry::enter_once_block() const'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::expressions::tag::message::get_name()':
/usr/local/boost/include/boost/log/expressions/message.hpp:56: undefined reference to `boost::log::v2s_mt_posix::aux::default_attribute_names::message()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::expressions::tag::smessage::get_name()':
/usr/local/boost/include/boost/log/expressions/message.hpp:70: undefined reference to `boost::log::v2s_mt_posix::aux::default_attribute_names::message()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue::unbounded_fifo_queue()':
/usr/local/boost/include/boost/log/sinks/unbounded_fifo_queue.hpp:71: undefined reference to `boost::log::v2s_mt_posix::aux::futex_based_event::futex_based_event()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue::enqueue(boost::log::v2s_mt_posix::record_view const&)':
/usr/local/boost/include/boost/log/sinks/unbounded_fifo_queue.hpp:84: undefined reference to `boost::log::v2s_mt_posix::aux::futex_based_event::set_signalled()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue::dequeue_ready(boost::log::v2s_mt_posix::record_view&)':
/usr/local/boost/include/boost/log/sinks/unbounded_fifo_queue.hpp:117: undefined reference to `boost::log::v2s_mt_posix::aux::futex_based_event::wait()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue::interrupt_dequeue()':
/usr/local/boost/include/boost/log/sinks/unbounded_fifo_queue.hpp:129: undefined reference to `boost::log::v2s_mt_posix::aux::futex_based_event::set_signalled()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::attributes::current_process_id::current_process_id()':
/usr/local/boost/include/boost/log/attributes/current_process_id.hpp:49: undefined reference to `boost::log::v2s_mt_posix::aux::this_process::get_id()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::attributes::current_thread_id::impl::dispatch(boost::log::v2s_mt_posix::type_dispatcher&)':
/usr/local/boost/include/boost/log/attributes/current_thread_id.hpp:69: undefined reference to `boost::log::v2s_mt_posix::aux::this_thread::get_id()'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::attributes::current_thread_id::impl::detach_from_thread()':
/usr/local/boost/include/boost/log/attributes/current_thread_id.hpp:79: undefined reference to `boost::log::v2s_mt_posix::aux::this_thread::get_id()'
/usr/local/boost/include/boost/log/attributes/current_thread_id.hpp:79: undefined reference to `boost::log::v2s_mt_posix::attribute::impl::operator new(unsigned long)'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::attribute_value::impl::~impl()':
/usr/local/boost/include/boost/log/attributes/attribute_value.hpp:73: undefined reference to `boost::log::v2s_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::attribute_value::impl::~impl()':
/usr/local/boost/include/boost/log/attributes/attribute_value.hpp:73: undefined reference to `boost::log::v2s_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
CMakeFiles/IrcChatData.dir/src/config.cpp.o: In function `boost::log::v2s_mt_posix::attributes::current_thread_id::current_thread_id()':
/usr/local/boost/include/boost/log/attrib
  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值