Boost 1.61 header 正在尝试重新定义 mpl_::bool_

Boost 1.61 header is trying to redefine mpl_::bool_

我正在使用 Boost 1.61 并使用 clang 4.0.1 进行编译,我正在为 linux-gnu

进行编译

之前我使用的是 Boost 1.52,没有遇到这个问题。仅通过更改版本,我收到有关重新定义 mpl_::bool_

的编译器错误

我没有使用任何预编译的增强库。这只是 headers。

这是我的包含,也是唯一的 boost 包含:

#include <system/math/math.h>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>

我遇到编译器错误:

1>  In file included from myfile.cpp:9:
1>  In file included from boost_1_61_0\boost/interprocess/managed_shared_memory.hpp:25:
1>  In file included from boost_1_61_0\boost/interprocess/detail/managed_memory_impl.hpp:30:
1>  In file included from boost_1_61_0\boost/interprocess/segment_manager.hpp:38:
1>  In file included from boost_1_61_0\boost/interprocess/allocators/allocator.hpp:30:
1>  In file included from boost_1_61_0\boost/interprocess/allocators/detail/allocator_common.hpp:32:
1>  In file included from boost_1_61_0\boost/interprocess/sync/scoped_lock.hpp:35:
1>  In file included from boost_1_61_0\boost/interprocess/detail/posix_time_types_wrk.hpp:32:
1>  In file included from boost_1_61_0\boost/date_time/posix_time/ptime.hpp:12:
1>  In file included from boost_1_61_0\boost/date_time/posix_time/posix_time_system.hpp:13:
1>  In file included from boost_1_61_0\boost/date_time/posix_time/posix_time_config.hpp:18:
1>  In file included from boost_1_61_0\boost/date_time/gregorian/gregorian_types.hpp:19:
1>  In file included from boost_1_61_0\boost/date_time/gregorian/greg_calendar.hpp:13:
1>  In file included from boost_1_61_0\boost/date_time/gregorian/greg_weekday.hpp:12:
1>  In file included from boost_1_61_0\boost/date_time/constrained_value.hpp:17:
1>  In file included from boost_1_61_0\boost/type_traits/is_base_of.hpp:12:
1>  In file included from boost_1_61_0\boost/type_traits/is_base_and_derived.hpp:13:
1>  boost_1_61_0\boost/type_traits/integral_constant.hpp:41:21: error: target of using declaration conflicts with declaration already in scope
1>        using ::mpl_::bool_;
1>                      ^
1>  boost_1_61_0\boost/type_traits/integral_constant.hpp:32:29: note: target of using declaration
1>     template <bool B> struct bool_;
1>                              ^
1>  boost_1_61_0\boost/mpl/bool.hpp:23:28: note: conflicting declaration
1>  template< bool C_ > struct bool_

clang 使用这些参数: -m64 -fdeclspec -Wall -mcx16 -msse4 -stdlib=libstdc++ -g -ggdb3 -O1 -fno-exceptions -std=c++11 -Wextra -DBOOST_DATE_TIME_NO_LIB

发现这是一个类似的错误:https://svn.boost.org/trac10/ticket/12212

注意到我已经为另一个库定义了这个,所以我取消定义它包括:

#undef BOOST_MPL_CFG_NO_ADL_BARRIER_NAMESPACE
#include <boost/interprocess/managed_shared_memory.hpp>
#define BOOST_MPL_CFG_NO_ADL_BARRIER_NAMESPACE