我正在使用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_0boost/interprocess/managed_shared_memory.hpp:25:
1> In file included from boost_1_61_0boost/interprocess/detail/managed_memory_impl.hpp:30:
1> In file included from boost_1_61_0boost/interprocess/segment_manager.hpp:38:
1> In file included from boost_1_61_0boost/interprocess/allocators/allocator.hpp:30:
1> In file included from boost_1_61_0boost/interprocess/allocators/detail/allocator_common.hpp:32:
1> In file included from boost_1_61_0boost/interprocess/sync/scoped_lock.hpp:35:
1> In file included from boost_1_61_0boost/interprocess/detail/posix_time_types_wrk.hpp:32:
1> In file included from boost_1_61_0boost/date_time/posix_time/ptime.hpp:12:
1> In file included from boost_1_61_0boost/date_time/posix_time/posix_time_system.hpp:13:
1> In file included from boost_1_61_0boost/date_time/posix_time/posix_time_config.hpp:18:
1> In file included from boost_1_61_0boost/date_time/gregorian/gregorian_types.hpp:19:
1> In file included from boost_1_61_0boost/date_time/gregorian/greg_calendar.hpp:13:
1> In file included from boost_1_61_0boost/date_time/gregorian/greg_weekday.hpp:12:
1> In file included from boost_1_61_0boost/date_time/constrained_value.hpp:17:
1> In file included from boost_1_61_0boost/type_traits/is_base_of.hpp:12:
1> In file included from boost_1_61_0boost/type_traits/is_base_and_derived.hpp:13:
1> boost_1_61_0boost/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_0boost/type_traits/integral_constant.hpp:32:29: note: target of using declaration
1> template <bool B> struct bool_;
1> ^
1> boost_1_61_0boost/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
注意到我已经为另一个lib定义了这个,所以我取消了它的定义,包括:
#undef BOOST_MPL_CFG_NO_ADL_BARRIER_NAMESPACE
#include <boost/interprocess/managed_shared_memory.hpp>
#define BOOST_MPL_CFG_NO_ADL_BARRIER_NAMESPACE