Boost logo

Boost Users :

Subject: Re: [Boost-users] Can't get boost log example to link
From: Leo Carreon (lcarreon_at_[hidden])
Date: 2013-07-22 03:00:35


-----Original Message-----
From: Jarrett Chisholm
Sent: Sunday, July 21, 2013 11:46 PM
To: Boost-users_at_[hidden]
Subject: [Boost-users] Can't get boost log example to link

hey all

I'm having trouble getting this simple boost log example to link:

#include <boost/log/trivial.hpp>

int main(int, char*[])
{
    BOOST_LOG_TRIVIAL(trace) << " a trace message ";
}

I can compile it ok, but linking causes the below issues:

g++ -o build/main.o -c -std=c++11 -Wall -g -O0 src/main.cpp
g++ -o build/test build/main.o -lboost_log -lboost_log_setup
-lboost_date_time -lboost_thread -lboost_wave -lboost_regex
-lboost_program_options -lboost_system -lboost_filesystem -lpthread
build/main.o: In function `main':
/home/jarrett/projects/chisholmsoft/logtest/src/main.cpp:5: undefined
reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
/home/jarrett/projects/chisholmsoft/logtest/src/main.cpp:5: undefined
reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
build/main.o: In function `boost::log::v2s_mt_posix::record::reset()':
/usr/local/include/boost/log/core/record.hpp:153: undefined reference to
`boost::log::v2s_mt_posix::record_view::public_data::destroy(boost::log::v2s_mt_posix::record_view::public_data
const*)'
build/main.o: In function `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>
>
>::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&)':
/usr/local/include/boost/log/sources/basic_logger.hpp:457: undefined
reference to `boost::log::v2s_mt_posix::core::get_logging_enabled() const'
build/main.o: In function
`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()':
/usr/local/include/boost/log/sources/record_ostream.hpp:278: undefined
reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()'
build/main.o: In function
`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&)':
/usr/local/include/boost/log/sources/record_ostream.hpp:259: undefined
reference to
`boost::log::v2s_mt_posix::aux::stream_provider<char>::allocate_compound(boost::log::v2s_mt_posix::record&)'
/usr/local/include/boost/log/sources/record_ostream.hpp:259: undefined
reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()'
build/main.o: In function
`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()':
/usr/local/include/boost/log/sources/record_ostream.hpp:243: undefined
reference to
`boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)'
build/main.o: In function
`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)':
/usr/local/include/boost/log/sources/severity_feature.hpp:135: undefined
reference to `boost::log::v2s_mt_posix::sources::aux::get_severity_level()'
build/main.o: In function `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&)':
/usr/local/include/boost/log/sources/basic_logger.hpp:260: undefined
reference to
`boost::log::v2s_mt_posix::core::open_record(boost::log::v2s_mt_posix::attribute_set
const&)'
build/main.o: In function
`boost::log::v2s_mt_posix::core::push_record(boost::log::v2s_mt_posix::record&&)':
/usr/local/include/boost/log/core/core.hpp:308: undefined reference to
`boost::log::v2s_mt_posix::core::push_record_move(boost::log::v2s_mt_posix::record&)'
collect2: error: ld returned 1 exit status

I using the latest boost-trunk code from svn on Debian 7 Stable 64bit.

Anyone have any ideas?

Cheers

Jarrett
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Hi Jarrett,

If I'm not mistaken, you need to have -DBOOST_LOG_DYN_LINK on the compile
and link command lines.

Regards,
Leo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net