3.17.2multiple definition of 'luaL_setfuncs'

发现安卓编译的时候会报multiple definition of ‘luaL_setfuncs’,cjson.c里面有这个函数的定义

#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
/* Compatibility for Lua 5.1.
 *
 * luaL_setfuncs() is used to create a module table where the functions have
 * json_config_t as their first upvalue. Code borrowed from Lua 5.2 source. */
void luaL_setfuncs (lua_State *l, const luaL_Reg *reg, int nup)
{
    int i;

    luaL_checkstack(l, nup, "too many upvalues");
    for (; reg->name != NULL; reg++) {  /* fill the table with given functions */
        for (i = 0; i < nup; i++)  /* copy upvalues to the top */
            lua_pushvalue(l, -nup);
        lua_pushcclosure(l, reg->func, nup);  /* closure with those upvalues */
        lua_setfield(l, -(nup + 2), reg->name);
    }
    lua_pop(l, nup);  /* remove upvalues */
}
#endif

然后查看external/lua/luajit/prebuilt/android下面预编译的静态库能发现里面有内置实现了luaL_setfuncs这个函数,然而iOS,Mac,以及linux和win32的版本都是没有这个函数的

注释看清楚
说明lua包含了这个函数

然后查看external/lua/luajit/prebuilt/android下面预编译的静态库能发现里面有内置实现了luaL_setfuncs这个函数,然而iOS,Mac,以及linux和win32的版本都是没有这个函数的

1,可以把这个名字改成luaL_setfuncsEx,然后调用的地方也改成luaL_setfuncsEx
2,或者去掉这个