我正在使用 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 打补丁。
关于c++ - 构建 luabind 时出现错误 C2665,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31395223/