我正在Boost 1.61上并使用clang 4.0.1进行编译,并且正在为linux-gnu进行编译
以前,我使用的是Boost 1.52,没有这个问题。仅通过更改版本,我就收到有关重新定义mpl_::bool_
我没有使用任何预编译的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正在使用这些args:
-m64 -fdeclspec -Wall -mcx16 -msse4 -stdlib=libstdc++ -g -ggdb3 -O1 -fno-exceptions -std=c++11 -Wextra -DBOOST_DATE_TIME_NO_LIB
答案 0 :(得分:0)
发现了类似错误: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