[log] link problems with keywords::format

Using msvc 8 I am having a link issue with the following code snippet. Commenting out the line with blog::keywords::format will cause the link error to go away. --------------------------------------------------- #include <iostream> #include <boost/log/attributes.hpp> #include <boost/log/common.hpp> #include <boost/log/core.hpp> #include <boost/log/exceptions.hpp> #include <boost/log/filters.hpp> #include <boost/log/formatters.hpp> #include <boost/log/sinks.hpp> #include <boost/log/trivial.hpp> #include <boost/log/utility/init/to_file.hpp> #include <boost/log/utility/init/common_attributes.hpp> namespace blog = boost::log ; int main() { blog::init_log_to_file( blog::keywords::file_name = "foo_%N.log", blog::keywords::rotation_size = 10 * 1024 * 1024, blog::keywords::format = "[%TimeStamp%]: %_%", blog::keywords::open_mode = std::ios_base::app ); BOOST_LOG_TRIVIAL(trace) << "A trace severity message"; return 0; } ------------------------------------------------------ main.obj : error LNK2019: unresolved external symbol "class boost::function2<void,class std::basic_ostream<char,struct std::char_traits<char> > &,class boost::log_mt_nt5::basic_record<char> const &> __cdecl boost::log_mt_nt5::parse_formatter<char>(char const *,char const *)" (??$parse_formatter@D@log_mt_nt5@boost@@YA?AV?$function2@XAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@ABV?$basic_record@D@log_mt_nt5@boost@@@1@PBD0@Z) referenced in function "class boost::function2<void,class std::basic_ostream<char,struct std::char_traits<char> > &,class boost::log_mt_nt5::basic_record<char> const &> __cdecl boost::log_mt_nt5::parse_formatter<char>(char const *)" (??$parse_formatter@D@log_mt_nt5@boost@@YA?AV?$function2@XAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@ABV?$basic_record@D@log_mt_nt5@boost@@@1@PBD@Z) bin\msvc-8.0\release\threading-multi\trivial.exe : fatal error LNK1120: 1 unresolved externals ------------------------------------------------------ Any ideas? michael -- ---------------------------------- Michael Caisse Object Modeling Designs www.objectmodelingdesigns.com

On 02/28/2010 02:38 AM, Michael Caisse wrote:
Using msvc 8 I am having a link issue with the following code snippet. Commenting out the line with blog::keywords::format will cause the link error to go away.
First, init_log_to_file will not alter the name of the file trivial logging uses. You'll just have two file sinks and thus two files logs are written to at the same time. Second, I believe the linking problem is due to lack of the log_setup library in your linker flags. This part of the library implements initialization routines involved into the init_log_to_file call.
participants (2)
-
Andrey Semashev
-
Michael Caisse