开发者

Boost "is_virtual_base_of" compile error when migrating working module

开发者 https://www.devze.com 2023-04-10 11:50 出处:网络
I have been working with boost serialization, I developed a whole module to store classes in persistent storage, but when I try to migrate my module to other project I got some errors I have never see

I have been working with boost serialization, I developed a whole module to store classes in persistent storage, but when I try to migrate my module to other project I got some errors I have never seen and I don't found any related information on the net.

The error I get is:

In file included from support.../boost_1_44/boost/serialization/void_cast.hpp:29,
                 from support.../boost_1_44/boost/archive/detail/oserializer.hpp:57,
                 from support.../boost_1_44/boost/archive/detail/interface_oarchive.hpp:23,
                 from support.../boost_1_44/boost/archive/detail/common_oarchive.hpp:22,
                 from support.../boost_1_44/boost/archive/basic_binary_oarchive.hpp:34,
                 from support.../boost_1_44/boost/archive/binary_oarchive_impl.hpp:23,
                 from support.../boost_1_44/boost/archive/binary_oarchive.hpp:21,
                 from .../ps_proxy.h:54,

support.../boost_1_44/boost/type_traits/is_virtual_base_of.hpp:57:10: error: macro "X" requires 2 arguments, but only 1 given
support.../boost_1_44/boost/type_traits/is_virtual_base_of.hpp:58:18: error: macro "X" requires 2 arguments, but only 1 given
support.../boost_1_44/boost/type_traits/is_virtual_base_of.hpp:60:11: error: macro "X" requires 2 arguments, but only 1 given
support.../boost_1_44/boost/type_traits/is_virtual_base_of.hpp:57: error: declaration does not declare anything
support.../boost_1_44/boost/type_traits/is_virtual_base_of.hpp:58: error: declaration does not declare anything
support.../boost_1_44/boost/type_traits/is_virtual_base_of.hpp:60: error: declaration of '~boost::detail::is_virtual_base_of_impl<Base, Derived, mpl_::bool_<true> >::X' as non-function
support.../boost开发者_运维技巧_1_44/boost/type_traits/is_virtual_base_of.hpp:60: error: expected ';' before 'throw'

I hope someone can give me some tip regarding why this could happend and why it works correctly on one module and when i migrate it (supposed to be transparent migration) it throws these erros.

Thanks!


  1. boost::is_virtual_base_of<> is used somewhere in the implementation of Boost.Serialization.
  2. In Boost 1.44, boost::is_virtual_base_of<> used types named X and Y as implementation details.
  3. Somewhere in your other project there is a macro named X defined, breaking the X type used in the implementation of boost::is_virtual_base_of<>.

Clearly X is a terrible macro name -- if it's yours then find a better name, and if it's not then email the author of whatever library did define it and complain (then #undef it before including any Boost headers).

FWIW, this was apparently a common enough issue that in Boost 1.47 types named boost_type_traits_internal_struct_X and boost_type_traits_internal_struct_Y are used instead of X and Y, so upgrading to a more current version of Boost is another way to work around your symptom.

0

精彩评论

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