I've got a pretty minimal sample project for boost.log running on Xcode 5, which goes like this:
#include <iostream>
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sinks/text_file_backend.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/expressions/formatters/date_time.hpp>
#include <boost/log/support/date_time.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/log/utility/setup/console.hpp>
namespace logging = boost::log;
namespace keywords = boost::log::keywords;
namespace src = boost::log::sources;
namespace expr = boost::log::expressions;
int main(int argc, const char *argv[])
{
logging::add_file_log
(
keywords::file_name = "Out_%N.log",
keywords::format =
(
expr::stream
<< expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d %H:%M:%S")
<< ": [" << logging::trivial::severity
<< "] " << expr::smessage
)
);
logging::core::get()->set_filter(logging::trivial::severity >= logging::trivial::debug);
logging::add_common_attributes();
src::severity_logger< logging::trivial::severity_level > logger;
BOOST_LOG_SEV(logger, logging::trivial::warning) << "a warning message";
return 0;
}
Now everything runs fine with a command line project.
However as soon as I use the snipped in a real-world project with the default Xcode precompiled header file I'm getting compiler errors in boost/type_traits/detail/has_binary_operator.hpp
and boost/lexical_cast.hpp
.
Precompiled header test_prefix.pch
:
//
// Prefix header for all source files in project
//
#include <Carbon/Carbon.h>
Already wasted hours fiddling with compiler settings and project configuration in Xcode so any feedback is appreciated!