1

目前我正在尝试使用 boost 构建一个项目。但它给出了一条错误消息,指示缺少运算符。

[  6%] Building CXX object CMakeFiles/osrm-extract.dir/extractor.cpp.o
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/mwh/Desktop/Downloads/Project-OSRM-master/Extractor/ScriptingEnvironment.h:29,
                 from /home/mwh/Desktop/Downloads/Project-OSRM-master/extractor.cpp:23:
/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/mwh/Desktop/Downloads/Project-OSRM-master/Extractor/ScriptingEnvironment.h:29,
                 from /home/mwh/Desktop/Downloads/Project-OSRM-master/extractor.cpp:23:
/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/mwh/Desktop/Downloads/Project-OSRM-master/Extractor/ScriptingEnvironment.h:29,
                 from /home/mwh/Desktop/Downloads/Project-OSRM-master/extractor.cpp:23:
/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/mwh/Desktop/Downloads/Project-OSRM-master/Extractor/ScriptingEnvironment.h:29,
                 from /home/mwh/Desktop/Downloads/Project-OSRM-master/extractor.cpp:23:
/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/mwh/Desktop/Downloads/Project-OSRM-master/Extractor/ScriptingEnvironment.h:29,
                 from /home/mwh/Desktop/Downloads/Project-OSRM-master/extractor.cpp:23:
/usr/include/luabind/detail/call_member.hpp:319:1: error: missing binary operator before token "("
make[2]: *** [CMakeFiles/osrm-extract.dir/extractor.cpp.o] Error 1
make[1]: *** [CMakeFiles/osrm-extract.dir/all] Error 2
make: *** [all] Error 2

我做了一些研究,发现它实际上是luabind 中的一个错误。它说改变

#elif BOOST_PP_ITERATION_FLAGS() == 1

和 :

#else
#if BOOST_PP_ITERATION_FLAGS() == 1

纠正问题。所以我修改了文件/usr/include/luabind/wrapper_base.hpp,就像它说的那样。但它不起作用。

后来我发现有一个补丁可以解决这个问题。但我不知道如何将该补丁添加到 luabind。请告诉我该怎么做。提前致谢。

4

1 回答 1

2

我有同样的问题。

我使用的是 Ubuntu 12.04、boost 1.49、luabind 0.9.1、g++ 4.6.3,而且这个 boost 和 luabind 之间似乎不兼容。

不过,仅针对这些版本,在办公室我有 boost 1.41 和 luabind 0.9.0,它们工作正常。

编辑:

实际上在修改了3个文件之后:call_function.hpp、call_member.hpp和wrapper_base.hpp,如您提到的网页中所述。以便:

#elif BOOST_PP_ITERATION_FLAGS() == 1
...
#end

被替换为:

#else
#if BOOST_PP_ITERATION_FLAGS() == 1
...
#end
#end

我能够编译我的 luabind 程序。

也许您忘记添加第二个 #end ?

于 2013-08-24T11:23:19.683 回答