错误C2665构建luabind时

error C2665 when building luabind

本文关键字:luabind 构建 C2665 错误      更新时间:2023-10-16

我使用Lua5.1Boost 1.58.0来尝试构建luabind-0.7.1-rc1。环境变量都设置正确。我已经为这个问题寻找了一个星期的答案,但是没有成功。

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

error C2665: 'boost::operator ==' : none of the 4 overloads could convert all the argument types
s:luabind-0.7.1-rc1luabindobject.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-rc1luabindobject.hpp(542): error C2665: 'boost::operator ==' : none of the 4 overloads could convert all the argument types
          s:boost_1_58_0boostfunctionfunction_base.hpp(750): could be 'bool boost::operator ==(boost::detail::function::useless_clear_type *,const boost::function_base &)'
          s:boost_1_58_0boostfunctionfunction_base.hpp(738): or       'bool boost::operator ==(const boost::function_base &,boost::detail::function::useless_clear_type *)'
          s:boost_1_58_0boostfunctionfunction_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_0boostfunctionfunction_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一起工作。

您现在可以(2015年9月)切换到luabind 0.9而不是使用0.7版本