Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
> print("Hello World!")
Hello World!
>
print("Hello world");
print("-----------------------------");
-----------------------------
Hello world
-----------------------------
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
int main(int argc, char *argv[])
{
char line[BUFSIZ];
lua_State *L = luaL_newstate();
luaL_openlibs(L);
//while (fgets(line, sizeof(line), stdin) != 0) printf("%s\n",line);
luaL_dofile(L, "test.lua");
lua_close(L);
return 0;
}
tao@tao:~/lua-5.2.0$ ./a
-----------------------------
Hello world
-----------------------------
a.c: 在函数‘main’中:
a.c:9:24: 警告: 初始化时将整数赋给指针,未作类型转换 [默认启用]
/tmp/cc5nUKNq.o: In function `main':
a.c:(.text+0x23): undefined reference to `lua_open'
a.c:(.text+0x33): undefined reference to `luaL_openlibs'
a.c:(.text+0x6e): undefined reference to `lua_close'
a.c: 在函数‘main’中:
a.c:9:24: 警告: 初始化时将整数赋给指针,未作类型转换 [默认启用]
/tmp/ccLLtNhW.o: In function `main':
a.c:(.text+0x23): undefined reference to `lua_open'
/usr/local/lib/liblua.a(lvm.o): In function `luaV_execute':
lvm.c:(.text+0x16d8): undefined reference to `pow'
/usr/local/lib/liblua.a(lobject.o): In function `luaO_arith':
lobject.c:(.text+0x120): undefined reference to `pow'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_tan':
lmathlib.c:(.text+0x16c): undefined reference to `tan'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_tanh':
lmathlib.c:(.text+0x1ac): undefined reference to `tanh'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_sqrt':
lmathlib.c:(.text+0x20e): undefined reference to `sqrt'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_sin':
lmathlib.c:(.text+0x23c): undefined reference to `sin'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_sinh':
lmathlib.c:(.text+0x27c): undefined reference to `sinh'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_pow':
lmathlib.c:(.text+0x5d8): undefined reference to `pow'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_log':
lmathlib.c:(.text+0x6ba): undefined reference to `log'
lmathlib.c:(.text+0x6ca): undefined reference to `log'
lmathlib.c:(.text+0x6ed): undefined reference to `log10'
lmathlib.c:(.text+0x700): undefined reference to `log'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_log10':
lmathlib.c:(.text+0x72c): undefined reference to `log10'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_fmod':
lmathlib.c:(.text+0x865): undefined reference to `fmod'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_exp':
lmathlib.c:(.text+0x88c): undefined reference to `exp'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_cos':
lmathlib.c:(.text+0x8cc): undefined reference to `cos'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_cosh':
lmathlib.c:(.text+0x90c): undefined reference to `cosh'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_atan':
lmathlib.c:(.text+0x94c): undefined reference to `atan'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_atan2':
lmathlib.c:(.text+0x9a8): undefined reference to `atan2'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_asin':
lmathlib.c:(.text+0x9ec): undefined reference to `asin'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_acos':
lmathlib.c:(.text+0xa2c): undefined reference to `acos'
/usr/local/lib/liblua.a(loadlib.o): In function `ll_loadfunc':
loadlib.c:(.text+0x8e9): undefined reference to `dlsym'
loadlib.c:(.text+0x950): undefined reference to `dlopen'
loadlib.c:(.text+0x981): undefined reference to `dlerror'
loadlib.c:(.text+0x9a1): undefined reference to `dlerror'
/usr/local/lib/liblua.a(loadlib.o): In function `gctm':
loadlib.c:(.text+0xd1c): undefined reference to `dlclose'
a.c: 在函数‘main’中:
a.c:9:24: 警告: 初始化时将整数赋给指针,未作类型转换 [默认启用]
/tmp/ccqm5luQ.o: In function `main':
a.c:(.text+0x23): undefined reference to `lua_open'
/usr/local/lib/liblua.a(lvm.o): In function `luaV_execute':
lvm.c:(.text+0x16d8): undefined reference to `pow'
/usr/local/lib/liblua.a(lobject.o): In function `luaO_arith':
lobject.c:(.text+0x120): undefined reference to `pow'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_tan':
lmathlib.c:(.text+0x16c): undefined reference to `tan'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_tanh':
lmathlib.c:(.text+0x1ac): undefined reference to `tanh'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_sqrt':
lmathlib.c:(.text+0x20e): undefined reference to `sqrt'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_sin':
lmathlib.c:(.text+0x23c): undefined reference to `sin'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_sinh':
lmathlib.c:(.text+0x27c): undefined reference to `sinh'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_pow':
lmathlib.c:(.text+0x5d8): undefined reference to `pow'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_log':
lmathlib.c:(.text+0x6ba): undefined reference to `log'
lmathlib.c:(.text+0x6ca): undefined reference to `log'
lmathlib.c:(.text+0x6ed): undefined reference to `log10'
lmathlib.c:(.text+0x700): undefined reference to `log'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_log10':
lmathlib.c:(.text+0x72c): undefined reference to `log10'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_fmod':
lmathlib.c:(.text+0x865): undefined reference to `fmod'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_exp':
lmathlib.c:(.text+0x88c): undefined reference to `exp'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_cos':
lmathlib.c:(.text+0x8cc): undefined reference to `cos'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_cosh':
lmathlib.c:(.text+0x90c): undefined reference to `cosh'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_atan':
lmathlib.c:(.text+0x94c): undefined reference to `atan'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_atan2':
lmathlib.c:(.text+0x9a8): undefined reference to `atan2'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_asin':
lmathlib.c:(.text+0x9ec): undefined reference to `asin'
/usr/local/lib/liblua.a(lmathlib.o): In function `math_acos':
lmathlib.c:(.text+0xa2c): undefined reference to `acos'
/usr/local/lib/liblua.a(loadlib.o): In function `ll_loadfunc':
loadlib.c:(.text+0x8e9): undefined reference to `dlsym'
loadlib.c:(.text+0x950): undefined reference to `dlopen'
loadlib.c:(.text+0x981): undefined reference to `dlerror'
loadlib.c:(.text+0x9a1): undefined reference to `dlerror'
/usr/local/lib/liblua.a(loadlib.o): In function `gctm':
loadlib.c:(.text+0xd1c): undefined reference to `dlclose'
a.c: 在函数‘main’中:
a.c:9:24: 警告: 初始化时将整数赋给指针,未作类型转换 [默认启用]
/tmp/cctbGHDQ.o: In function `main':
a.c:(.text+0x23): undefined reference to `lua_open'