c++ - 构建 luabind 时出现错误 C2665

标签 c++ boost lua luabind

我正在使用 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>)'

有没有人对这个问题有洞察力或经验? 可能导致此错误的原因是什么,我该如何解决它,以及将来如何避免它?

最佳答案

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

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

关于c++ - 构建 luabind 时出现错误 C2665,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31395223/

相关文章:

c++ - 如何为复制交换习语实现复制构造函数

c++ - 需要帮助创建一个 24 分钟的时钟

c++ - OpenMP 中的信号

c++ - ostream operator<< 为采用 STL 容器而重载,传递 std::string 会破坏它吗?

boost asio channel "no type named ' receive_cancelled_signature'"

c++ - Boost.Asio Win32 Windows 应用程序

c++ - 与 shell 脚本不同,批处理文件不可执行吗?

c - luajit ffi构造函数参数路由

c++ - lua - 在 C 中存储闭包,在 C 中调用异步

c++ - Lua 和 C++ 中的有限状态机