gpt4 book ai didi

c++ - boost_logging 编译失败,因为 'CRITICAL_SECTION' : ambiguous symbol

转载 作者:行者123 更新时间:2023-11-28 03:52:00 24 4
gpt4 key购买 nike

我正在使用 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'

奇怪的是,这在我的一台电脑上运行良好,但在另一台电脑上却不行,所以可能是 winbase.h include 不同。

编辑:

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

最佳答案

尝试在 Windows header 之前包括 boost 日志记录 header 。

关于c++ - boost_logging 编译失败,因为 'CRITICAL_SECTION' : ambiguous symbol,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5152714/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com