lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Lua-l list,

I'm new here, I'm looking for the embedding solutions, and I found Lua - it's easy and likeable language.

I've found several example to embed Lua to C (and C++ code), but I can't compile them on my Linux Mint 17.1.

The last example was here:

https://www.debian-administration.org/article/264/Embedding_a_scripting_language_inside_your_C/C_code

There is the first example with 26 lines of code, and the gcc command. I've tried several examples, but I always got this error:

luainit.c:(.text+0x10): undefined reference to `lua_open'
luainit.c:(.text+0x26): undefined reference to `luaopen_base'
luainit.c:(.text+0x35): undefined reference to `luaopen_table'


or in other snippets from other examles:

luaload.c:(.text+0x1c): undefined reference to `luaL_newstate'
luaload.c:(.text+0x33): undefined reference to `luaL_openlibs'
luaload.c:(.text+0x44): undefined reference to `luaL_loadfile'
...

I've tried them with lua5.2, lua5.1, and now the current version is lua5.0. The gcc command is exactly:

gcc -o luainit -Wall `lua-config --include --libs` luainit.c

but I've tried it with this too:

gcc -o luainit -Wall `lua-config --include --libs` -lm -ldl luainit.c

The output of "lua-config -include --libs" is this:

-I/usr/include/lua50 -L/usr/include -llualib50 -llua50

What em I missing?


Thanks,

a.