【发布时间】:2014-01-28 19:05:35
【问题描述】:
我有一个在 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.hpp 和 boost/lexical_cast.hpp 中遇到编译器错误。
预编译头test_prefix.pch:
//
// Prefix header for all source files in project
//
#include <Carbon/Carbon.h>
已经浪费了几个小时在 Xcode 中摆弄编译器设置和项目配置,因此感谢任何反馈!
【问题讨论】:
-
你为什么不显示你得到的错误?另外,有没有理由相信这是由于 PCH 设置造成的?您是否在同一个项目中看到问题消失了?
-
标签: c++ xcode boost boost-log boost-logging