【问题标题】:error: missing binary operator before token "("错误:在标记“(”之前缺少二元运算符
【发布时间】:2012-03-09 09:33:09
【问题描述】:

gcc 升级后,我的项目由于错误而无法构建:

In file included from /usr/include/luabind/wrapper_base.hpp:31:0,
                 from /usr/include/luabind/back_reference.hpp:27,
                 from /usr/include/luabind/class.hpp:93,
                 from /usr/include/luabind/luabind.hpp:28,
                 from /home/ockonal/Workspace/themisto/engine/include/Scripting/ScriptManager.hpp:21,
                 from /home/ockonal/Workspace/themisto/engine/source/Core/Root.cpp:28:
/usr/include/luabind/detail/call_member.hpp:319:1: error: missing binary operator before token "("
In file included from /usr/include/luabind/back_reference.hpp:27:0,
                 from /usr/include/luabind/class.hpp:93,
                 from /usr/include/luabind/luabind.hpp:28,
                 from /home/ockonal/Workspace/themisto/engine/include/Scripting/ScriptManager.hpp:21,
                 from /home/ockonal/Workspace/themisto/engine/source/Core/Root.cpp:28:
/usr/include/luabind/wrapper_base.hpp:92:1: error: missing binary operator before token "("
In file included from /usr/include/luabind/function.hpp:10:0,
                 from /usr/include/luabind/class.hpp:94,
                 from /usr/include/luabind/luabind.hpp:28,
                 from /home/ockonal/Workspace/themisto/engine/include/Scripting/ScriptManager.hpp:21,
                 from /home/ockonal/Workspace/themisto/engine/source/Core/Root.cpp:28:
/usr/include/luabind/detail/call_function.hpp:326:1: error: missing binary operator before token "("
In file included from /usr/include/luabind/detail/constructor.hpp:12:0,
                 from /usr/include/luabind/class.hpp:96,
                 from /usr/include/luabind/luabind.hpp:28,
                 from /home/ockonal/Workspace/themisto/engine/include/Scripting/ScriptManager.hpp:21,
                 from /home/ockonal/Workspace/themisto/engine/source/Core/Root.cpp:28:
/usr/include/luabind/wrapper_base.hpp:92:1: error: missing binary operator before token "("
In file included from /usr/include/luabind/class.hpp:107:0,
                 from /usr/include/luabind/luabind.hpp:28,
                 from /home/ockonal/Workspace/themisto/engine/include/Scripting/ScriptManager.hpp:21,
                 from /home/ockonal/Workspace/themisto/engine/source/Core/Root.cpp:28:
/usr/include/luabind/detail/call_member.hpp:319:1: error: missing binary operator before token "("

可能是什么?我也尝试过最新的 gcc (4.8) 快照,但没有帮助。

附言

extra/boost 1.49.0-1 [installed]
core/gcc 4.6.3-1 (base-devel) [installed]
aurbuild/luabind 0.9.1-1 [installed]

【问题讨论】:

  • 能否请您提供最少的代码来解决至少一种输出错误的情况?
  • @izomorphius 错误与我的代码无关。我已经删除了 luabind 并下载了最新的稳定版本。由于给定文件中的错误(来自错误输出),我无法构建它。
  • 所有这些你得到错误的行都类似于#elif BOOST_PP_ITERATION_FLAGS() == 1
  • 我已经更改了您问题的摘要,以便在搜索错误时更容易找到它。
  • 如果您的搜索到达此页面,但您在没有提升的情况下收到此错误,请参阅 here 以获取对该消息的更一般说明。

标签: c++ gcc luabind


【解决方案1】:

由于 luabind 以谷歌 google project 的形式存在,我能够浏览代码并找到导致错误的行。它们看起来都像:

#elif BOOST_PP_ITERATION_FLAGS() == 1

似乎其他人遇到了这个问题,我找到了这个thread,希望对您有所帮助。

【讨论】:

  • 谢谢。也许,你知道如何解决它:#define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/wrapper_base.hpp>, 1)) 我从未使用过 BOOST 的这个宏。
  • 据我所知,这家伙只是将 elif 更改为 else if,这似乎可以解决问题。它不适合你吗?
  • 在wrapper_base.hpp中,在第93行左右添加#else#if后,需要在文件末尾额外添加#endif
猜你喜欢
  • 1970-01-01
  • 2022-11-13
  • 1970-01-01
  • 1970-01-01
  • 2019-08-29
  • 1970-01-01
  • 2023-03-26
  • 2014-02-15
  • 1970-01-01
相关资源
最近更新 更多