0

我正在为我的项目使用boost_logging

在我的一个文件中,我只使用了我的日志记录工具: LDBG_ << "something" 但它没有进行编译,我有以下错误:

1>c:\boost\boost_logging\boost\logging\detail\ts\ts_win32.hpp(57) : error C2872: 'CRITICAL_SECTION' : ambiguous symbol    
1>        could be 'c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(314) : RTL_CRITICAL_SECTION CRITICAL_SECTION'   
1>        or 'c:\boost\boost135\boost\detail\lwm_win32_cs.hpp(33) : boost::detail::CRITICAL_SECTION'

奇怪的是,这在我的一台 PC 上运行良好,但在另一台 PC 上运行良好,因此可能是 winbase.h 包含不同。

编辑:

以下是 LDBG_ 日志的定义方式:

#include <boost/logging/format_fwd.hpp>
#include <boost/logging/format_ts.hpp>

typedef boost::logging::scenario::usage::use<
        //  the filter is always accurate (but slow)
        //boost::logging::scenario::usage::filter_::change::always_accurate, 
        boost::logging::scenario::usage::filter_::change::often< 10 >,
        //  filter does not use levels
        boost::logging::scenario::usage::filter_::level::no_levels, 
        // the logger is initialized once, when only one thread is running
        boost::logging::scenario::usage::logger_::change::set_once_when_one_thread, 
        // the logger favors speed (on a dedicated thread)
        boost::logging::scenario::usage::logger_::favor::speed> finder;

BOOST_DECLARE_LOG_FILTER(g_log_filter, finder::filter ) 
BOOST_DECLARE_LOG(g_log_dbg, finder::logger)

#define LDBG_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_dbg(), g_log_filter()->is_enabled() ) 
4

1 回答 1

2

尝试在Windows 标头之前包含提升日志记录标头。

于 2011-03-01T09:49:10.967 回答