c – 构建luabind时出错C2665

我正在使用Lua5.1和Boost 1.58.0来尝试构建luabind-0.7.1-rc1.环境变量都已正确设置.我一直在寻找这个答案大约一个星期,现在没有成功.

每当我尝试构建luabind时,我都会得到20个相同的错误:

error C2665: 'boost::operator ==' : none of the 4 overloads could convert all the argument types
s:\luabind-0.7.1-rc1\luabind\object.hpp 542 1

所有错误似乎都是从#undef之前的最后两行抛出的:

// Needed because of some strange ADL issues.

#define LUABIND_OPERATOR_ADL_WKND(op) \
  inline bool operator op( \
      basic_iterator<basic_access> const& x \
    , basic_iterator<basic_access> const& y) \
  { \
      return boost::operator op(x, y); \
  } \
 \
  inline bool operator op( \
      basic_iterator<raw_access> const& x \
    , basic_iterator<raw_access> const& y) \
  { \
      return boost::operator op(x, y); \
  }

  LUABIND_OPERATOR_ADL_WKND(==)
  LUABIND_OPERATOR_ADL_WKND(!=)

#undef LUABIND_OPERATOR_ADL_WKND

这里有一些输出本身(它重复这样):

s:\luabind-0.7.1-rc1\luabind\object.hpp(542): error C2665: 'boost::operator ==' : none of the 4 overloads could convert all the argument types
          s:\boost_1_58_0\boost\function\function_base.hpp(750): could be 'bool boost::operator ==(boost::detail::function::useless_clear_type *,const boost::function_base &)'
          s:\boost_1_58_0\boost\function\function_base.hpp(738): or       'bool boost::operator ==(const boost::function_base &,boost::detail::function::useless_clear_type *)'
          s:\boost_1_58_0\boost\function\function_base.hpp(809): or       'bool boost::operator ==<luabind::detail::basic_iterator<luabind::detail::basic_access>>(Functor,const boost::function_base &)'
          with
          [
              Functor=luabind::detail::basic_iterator<luabind::detail::basic_access>
          ]
          s:\boost_1_58_0\boost\function\function_base.hpp(800): or       'bool boost::operator ==<luabind::detail::basic_iterator<luabind::detail::basic_access>>(const boost::function_base &,Functor)'
          with
          [
              Functor=luabind::detail::basic_iterator<luabind::detail::basic_access>
          ]
          while trying to match the argument list '(const luabind::detail::basic_iterator<luabind::detail::basic_access>, const luabind::detail::basic_iterator<luabind::detail::basic_access>)'

有没有人有这方面的见解或经验?
可能导致此错误的原因是什么,如何修复它,以及如何在将来避免它?

最佳答案 您需要使用较旧的boost库. luabind 0.7.1来自2008年.从同年开始试用Boost版本.我对luabind 0.8.1和Boost 1.58.0有完全相同的问题.

在我的情况下,1.55.0运行良好,它适用于vs2013.显然,旧版本的Boost需要为vs2013打补丁.

点赞