C++调用lua编译报错

编译的时候
#g++ -o luac  luac.cpp  -llua -ldl


编译但是错误信息
c.cpp: In function `int main()':
luac.cpp:43: error: `lua_baselibopen' was not declared in this scope

luac.cpp:46: error: `lua_dofile' was not declared in this scope


解决方法:

改成
luaopen_base(L);
luaL_dofile(L, "add.lua");

你可能感兴趣的:(C++,function,lua)