开发者

boost_logging fails to compile, because of 'CRITICAL_SECTION' : ambiguous symbol

开发者 https://www.devze.com 2023-02-14 14:38 出处:网络
I am using boost_logging for my project. In one of my file I just use my logging facility: LDBG_ << \"something\"

I am using boost_logging for my project.

In one of my file I just use my logging facility: LDBG_ << "something" but it does not seam to compile, I have the following error:

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'

The weird part is that this is working fine on one of my PC, but not on the other, so it might be the winbase.h include that is different.

EDIT:

Here is how the LDBG_ log is defined:

#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() ) 


Try including boost logging headers before windows headers.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号