我是Lua新手,尤其是Luabind新手。當我試圖編譯(鏗鏘++),我的第一個文件使用Luabind:如何使用LUA_COMPAT_ALL?
#define LUA_COMPAT_ALL
#include <luabind/luabind.hpp>
#include <luaconf.h>
#include <iostream>
int main() {
lua_State *myLuaState = luaL_newstate();
luabind::open(myLuaState);
luaL_dostring(
myLuaState,
"function add(first, second)\n"
" return first + second\n"
"end\n"
);
std::cout << "Result: "
<< luabind::call_function<int>(myLuaState, "add", 2, 3)
<< std::endl;
lua_close(myLuaState);
}
我的error messages整個堆。
所以,我做了一些環顧四周,我發現它與我的Lua版本是5.2 VS 5.1做,發現解決方案是LUA_COMPAT_ALL
(這是我在Lua project compiling with errors (luabind)發現)。
不幸的是,當談到Lua的時候,我有些厭倦了;所以,我不知道我把它放在哪裏。
我希望我的問題是不是太傻:)
Lua 5.1和5.2有一些主要的不同之處。如果你致力於Lua 5.2,看起來好像有人已經採用了Luabind,並且創建了一個與5.2更兼容的新版本。 https://github.com/rpavlik/luabind也許試試? –
@AdamB我按照提示安裝了boost(通過brew),但是當我'bjam install'時它返回[errors](http://pastebin.com/QJzjaVAe) – Julian