-1
我的代码嵌入LUA运行时错误:找不到符号:_luaL_newstate
inline int DOFILE(string& filename) {
printf("lua_open\n");
/* initialize Lua */
lua_State* L = lua_open();
printf("lua_openlibs\n");
/* load Lua base libraries */
luaL_openlibs(L);
printf("lua_dofile\n");
/* run the script */
int ret = luaL_dofile(L, filename.c_str());
printf("lua_close\n");
/* cleanup Lua */
lua_close(L);
return ret;
}
编译选项:
obj.cxxflags = ["-g", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", "-Wall", "-llua-5.1"]
还试图 '-llua', '-llualib',所有的人都报告,警告
i686-apple-darwin11-llvm-g++-4.2: -llua-5.1: linker input file unused because linking not done
当我运行,其报告:
lua_open
dyld: lazy symbol binding failed: Symbol not found: _luaL_newstate
Referenced from: /Users/gl/workspace/node-lua/build/Release/node_lua.node
Expected in: flat namespace
dyld: Symbol not found: _luaL_newstate
Referenced from: /Users/gl/workspace/node-lua/build/Release/node_lua.node
Expected in: flat namespace
看到这个问题http://stackoverflow.com/questions/8552560/embedding-lua-in-c/8552620#8552620 – 2011-12-18 16:09:39
您的构建系统是否有像'obj.ldflags'设置?如果是这样,把图书馆放在那里。 – Mat 2011-12-18 16:10:53
@Mat我不确定,其实我是C++的newb,我试着编写一个node-addon,使用node-waf就是waf。我会谷歌它。谢谢。 – 2011-12-18 16:15:28