boost.log在使用Xcode预编译头时中断



我有一个在Xcode 5上运行的boost.log的非常小的示例项目,如下所示:

#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;
}

现在,使用命令行项目,一切都可以正常运行。

然而,当我在现实世界的项目中使用默认的Xcode预编译头文件时,boost/type_traits/detail/has_binary_operator.hppboost/lexical_cast.hpp中就会出现编译器错误。

预编译标头test_prefix.pch

//
// Prefix header for all source files in project
//
#include <Carbon/Carbon.h>

已经浪费了几个小时在Xcode中摆弄编译器设置和项目配置,所以任何反馈都很感激!

在前缀头中包含Carbon/Carbon.h之前,您可能需要#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0。看见https://svn.boost.org/trac/boost/ticket/6219了解更多信息。

最新更新