尝试在OSX上使用Boost.Log(通过MacPorts)
/*
* Copyright Andrey Semashev 2007 - 2013.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
namespace logging = boost::log;
//[ example_tutorial_trivial_with_filtering
void init()
{
logging::core::get()->set_filter
(
logging::trivial::severity >= logging::trivial::info
);
}
int main(int, char*[])
{
init();
BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
BOOST_LOG_TRIVIAL(info) << "An informational severity message";
BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
BOOST_LOG_TRIVIAL(error) << "An error severity message";
BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
return 0;
}
//]
(代码样本取自http://www.boost.org/doc/libs/1_54_0_beta1/libs/log/example/doc/tutorial_trivial_flt.cpp)
但是在编译大量未解决的外部错误时会产生错误:
$ gcc -I / opt / local / include loggertest.cpp -o loggertest -L / opt / local / lib -lboost_log-mt
Undefined symbols for architecture x86_64:
"boost::log::v2s_mt_posix::record_view::public_data::destroy(boost::log::v2s_mt_posix::record_view::public_data const*)", referenced from:
boost::log::v2s_mt_posix::record::reset() in loggertest-87632e.o
"boost::log::v2s_mt_posix::attribute_name::get_id_from_string(char const*)", referenced from:
boost::log::v2s_mt_posix::attribute_name::attribute_name(char const*) in loggertest-87632e.o
"boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)", referenced from:
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::auto_release::~auto_release() in loggertest-87632e.o
"boost::log::v2s_mt_posix::aux::stream_provider<char>::allocate_compound(boost::log::v2s_mt_posix::record&)", referenced from:
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::record_pump(boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>&, boost::log::v2s_mt_posix::record&) in loggertest-87632e.o
"boost::log::v2s_mt_posix::aux::unhandled_exception_count()", referenced from:
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::~record_pump() in loggertest-87632e.o
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::record_pump(boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>&, boost::log::v2s_mt_posix::record&) in loggertest-87632e.o
"boost::log::v2s_mt_posix::aux::attach_attribute_name_info(boost::exception&, boost::log::v2s_mt_posix::attribute_name const&)", referenced from:
boost::log::v2s_mt_posix::value_extractor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity>::operator()(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&) const in loggertest-87632e.o
"boost::log::v2s_mt_posix::core::set_filter(boost::log::v2s_mt_posix::filter const&)", referenced from:
init() in loggertest-87632e.o
"boost::log::v2s_mt_posix::core::open_record(boost::log::v2s_mt_posix::attribute_set const&)", referenced from:
boost::log::v2s_mt_posix::record boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >::open_record_unlocked<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> const&) in loggertest-87632e.o
"boost::log::v2s_mt_posix::core::push_record_move(boost::log::v2s_mt_posix::record&)", referenced from:
boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >::push_record_unlocked(boost::rv<boost::log::v2s_mt_posix::record>&) in loggertest-87632e.o
"boost::log::v2s_mt_posix::core::get()", referenced from:
init() in loggertest-87632e.o
"boost::log::v2s_mt_posix::sources::aux::get_severity_level()", referenced from:
boost::log::v2s_mt_posix::sources::aux::severity_level<boost::log::v2s_mt_posix::trivial::severity_level>::set_value(boost::log::v2s_mt_posix::trivial::severity_level) in loggertest-87632e.o
"boost::log::v2s_mt_posix::trivial::logger::get()", referenced from:
_main in loggertest-87632e.o
"boost::log::v2s_mt_posix::attribute_value_set::end() const", referenced from:
boost::log::v2s_mt_posix::value_extractor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity>::operator()(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&) const in loggertest-87632e.o
"boost::log::v2s_mt_posix::attribute_value_set::find(boost::log::v2s_mt_posix::attribute_name) const", referenced from:
boost::log::v2s_mt_posix::value_extractor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity>::operator()(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&) const in loggertest-87632e.o
"boost::log::v2s_mt_posix::core::get_logging_enabled() const", referenced from:
boost::log::v2s_mt_posix::record boost::log::v2s_mt_posix::sources::basic_composite_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex>, boost::log::v2s_mt_posix::sources::features<boost::log::v2s_mt_posix::sources::severity<boost::log::v2s_mt_posix::trivial::severity_level>, void, void, void, void, void, void, void, void, void> >::open_record<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> const&) in loggertest-87632e.o
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::aligned_write(char const*, long) in loggertest-87632e.o
"std::__1::ios_base::getloc() const", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::aligned_write(char const*, long) in loggertest-87632e.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::formatted_write(char const*, long) in loggertest-87632e.o
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::aligned_write(char const*, long) in loggertest-87632e.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(unsigned long, char)", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::aligned_write(char const*, long) in loggertest-87632e.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::formatted_write(char const*, long) in loggertest-87632e.o
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::flush() in loggertest-87632e.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::sentry::sentry(boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in loggertest-87632e.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::sentry::~sentry() in loggertest-87632e.o
"std::__1::ctype<char>::id", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::aligned_write(char const*, long) in loggertest-87632e.o
"std::__1::locale::~locale()", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::aligned_write(char const*, long) in loggertest-87632e.o
"std::terminate()", referenced from:
___clang_call_terminate in loggertest-87632e.o
"vtable for __cxxabiv1::__class_type_info", referenced from:
typeinfo for boost::exception in loggertest-87632e.o
typeinfo for boost::log::v2s_mt_posix::type_info_wrapper::uninitialized in loggertest-87632e.o
typeinfo for boost::log::v2s_mt_posix::aux::visible_type<boost::log::v2s_mt_posix::trivial::severity_level> in loggertest-87632e.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"operator delete(void*)", referenced from:
boost::log::v2s_mt_posix::aux::light_function<bool (boost::log::v2s_mt_posix::attribute_value_set const&)>::light_function<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater_equal, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::log::v2s_mt_posix::trivial::severity_level>, 0l> > >, 2l> > >(boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater_equal, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::log::v2s_mt_posix::trivial::severity_level>, 0l> > >, 2l> > const&, boost::disable_if_c<is_rv_or_same<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater_equal, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::log::v2s_mt_posix::trivial::severity_level>, 0l> > >, 2l> >, boost::log::v2s_mt_posix::aux::light_function<bool (boost::log::v2s_mt_posix::attribute_value_set const&)> >::value, int>::type) in loggertest-87632e.o
boost::log::v2s_mt_posix::aux::light_function<bool (boost::log::v2s_mt_posix::attribute_value_set const&)>::impl<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater_equal, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::log::v2s_mt_posix::trivial::severity_level>, 0l> > >, 2l> > >::clone_impl(void const*) in loggertest-87632e.o
boost::log::v2s_mt_posix::aux::light_function<bool (boost::log::v2s_mt_posix::attribute_value_set const&)>::impl<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater_equal, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::log::v2s_mt_posix::trivial::severity_level>, 0l> > >, 2l> > >::destroy_impl(void*) in loggertest-87632e.o
"operator new(unsigned long)", referenced from:
boost::log::v2s_mt_posix::aux::light_function<bool (boost::log::v2s_mt_posix::attribute_value_set const&)>::light_function<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater_equal, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::log::v2s_mt_posix::trivial::severity_level>, 0l> > >, 2l> > >(boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater_equal, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::log::v2s_mt_posix::trivial::severity_level>, 0l> > >, 2l> > const&, boost::disable_if_c<is_rv_or_same<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater_equal, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::log::v2s_mt_posix::trivial::severity_level>, 0l> > >, 2l> >, boost::log::v2s_mt_posix::aux::light_function<bool (boost::log::v2s_mt_posix::attribute_value_set const&)> >::value, int>::type) in loggertest-87632e.o
boost::log::v2s_mt_posix::aux::light_function<bool (boost::log::v2s_mt_posix::attribute_value_set const&)>::impl<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater_equal, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::log::v2s_mt_posix::trivial::severity_level>, 0l> > >, 2l> > >::clone_impl(void const*) in loggertest-87632e.o
"___cxa_begin_catch", referenced from:
___clang_call_terminate in loggertest-87632e.o
boost::log::v2s_mt_posix::value_extractor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity>::operator()(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&) const in loggertest-87632e.o
"___cxa_end_catch", referenced from:
boost::log::v2s_mt_posix::value_extractor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity>::operator()(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&) const in loggertest-87632e.o
"___cxa_rethrow", referenced from:
boost::log::v2s_mt_posix::value_extractor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity>::operator()(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&) const in loggertest-87632e.o
"___gxx_personality_v0", referenced from:
init() in loggertest-87632e.o
_main in loggertest-87632e.o
boost::log::v2s_mt_posix::record boost::log::v2s_mt_posix::sources::basic_composite_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex>, boost::log::v2s_mt_posix::sources::features<boost::log::v2s_mt_posix::sources::severity<boost::log::v2s_mt_posix::trivial::severity_level>, void, void, void, void, void, void, void, void, void> >::open_record<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> const&) in loggertest-87632e.o
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::formatted_write(char const*, long) in loggertest-87632e.o
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::aligned_write(char const*, long) in loggertest-87632e.o
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::~record_pump() in loggertest-87632e.o
boost::log::v2s_mt_posix::record boost::log::v2s_mt_posix::sources::basic_severity_logger<boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >, boost::log::v2s_mt_posix::trivial::severity_level>::open_record_unlocked<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> const&) in loggertest-87632e.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
其他boost库(系统,线程,文件系统)运行良好。我的链接器标志有问题吗?建立系统?安装?
编辑:我也尝试过使用clang ++,但是我得到了类似的错误:
$ clang ++ -I / opt / local / include loggertest.cpp -o loggertest -L / opt / local / lib -lboost_log-mt -lboost_log_setup-mt
Undefined symbols for architecture x86_64:
"boost::log::v2s_mt_posix::record_view::public_data::destroy(boost::log::v2s_mt_posix::record_view::public_data const*)", referenced from:
boost::log::v2s_mt_posix::record::reset() in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::attribute_name::get_id_from_string(char const*)", referenced from:
boost::log::v2s_mt_posix::attribute_name::attribute_name(char const*) in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)", referenced from:
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::auto_release::~auto_release() in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::aux::stream_provider<char>::allocate_compound(boost::log::v2s_mt_posix::record&)", referenced from:
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::record_pump(boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>&, boost::log::v2s_mt_posix::record&) in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::aux::unhandled_exception_count()", referenced from:
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::~record_pump() in loggertest-0b0a3b.o
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level> >::record_pump(boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>&, boost::log::v2s_mt_posix::record&) in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::aux::attach_attribute_name_info(boost::exception&, boost::log::v2s_mt_posix::attribute_name const&)", referenced from:
boost::log::v2s_mt_posix::value_extractor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity>::operator()(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&) const in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::core::set_filter(boost::log::v2s_mt_posix::filter const&)", referenced from:
init() in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::core::open_record(boost::log::v2s_mt_posix::attribute_set const&)", referenced from:
boost::log::v2s_mt_posix::record boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >::open_record_unlocked<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> const&) in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::core::push_record_move(boost::log::v2s_mt_posix::record&)", referenced from:
boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >::push_record_unlocked(boost::rv<boost::log::v2s_mt_posix::record>&) in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::core::get()", referenced from:
init() in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::sources::aux::get_severity_level()", referenced from:
boost::log::v2s_mt_posix::sources::aux::severity_level<boost::log::v2s_mt_posix::trivial::severity_level>::set_value(boost::log::v2s_mt_posix::trivial::severity_level) in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::trivial::logger::get()", referenced from:
_main in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::attribute_value_set::end() const", referenced from:
boost::log::v2s_mt_posix::value_extractor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity>::operator()(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&) const in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::attribute_value_set::find(boost::log::v2s_mt_posix::attribute_name) const", referenced from:
boost::log::v2s_mt_posix::value_extractor<boost::log::v2s_mt_posix::trivial::severity_level, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::trivial::tag::severity>::operator()(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&) const in loggertest-0b0a3b.o
"boost::log::v2s_mt_posix::core::get_logging_enabled() const", referenced from:
boost::log::v2s_mt_posix::record boost::log::v2s_mt_posix::sources::basic_composite_logger<char, boost::log::v2s_mt_posix::sources::severity_logger_mt<boost::log::v2s_mt_posix::trivial::severity_level>, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex>, boost::log::v2s_mt_posix::sources::features<boost::log::v2s_mt_posix::sources::severity<boost::log::v2s_mt_posix::trivial::severity_level>, void, void, void, void, void, void, void, void, void> >::open_record<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::severity, boost::log::v2s_mt_posix::trivial::severity_level const> const&) in loggertest-0b0a3b.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
编辑:通过@everpanic
建议的-DBOOST_LOG_DYN_LINK
进行编译来解决
答案 0 :(得分:1)
您遇到标准库不匹配问题。 MacPorts(以及MacPorts中的所有其他库以及10.9以来的现代OS X)都是针对clang的libc ++而不是gcc的libstdc ++构建的。如果你试图混合使用两个标准库,你就会遇到这个问题(这是一件好事,因为如果你没有看到这个,你可能会发现很难在运行时调试崩溃)。
您需要使用clang++
代替gcc
来编译代码。或者,您可以使用/usr/bin/g++
,现在是一个符号链接。