【问题标题】:error C2665 when building luabind构建 luabind 时出现错误 C2665
【发布时间】:2015-10-02 10:00:45
【问题描述】:

我正在使用 Lua5.1Boost 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>)'

有人对这个问题有见解或经验吗? 什么可能导致此错误,我该如何解决它,以及将来如何避免它?

【问题讨论】:

  • “环境变量都设置正确” 不是一个有用的说法:让我们来判断什么设置正确,什么不正确,因为你没有能够确定出乎意料的错误!如果您认为环境变量很重要,请向我们展示环境变量。

标签: c++ boost lua luabind


【解决方案1】:

您需要使用较旧的 bo​​ost 库。 luabind 0.7.1 来自 2008 年。尝试大约在同一年的 Boost 版本。我在使用 luabind 0.8.1 和 Boost 1.58.0 时遇到了完全相同的问题。

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2018-08-13
      • 2017-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-26
      • 2014-05-24
      • 2013-05-25
      相关资源
      最近更新 更多