lua-users home
lua-l archive

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


On 7/9/07, Patrick Donnelly <batrick@hotmail.com> wrote:

I'm trying to play around with Lua in C, and have been unable to get a Lua
interpreter to compile (the build your own one in PIL:
http://www.lua.org/pil/24.1.html).

I'm using Ubuntu linux, and when I try doing `gcc mytest.c` (mytest.c being
what I called the program), I get the following errors:

/tmp/ccWw87j6.o: In function `main':
mytest.c:(.text+0x2b): undefined reference to `luaL_newstate'

dude, C coding 101: you need to link with all the object files your
program needs to run :-)
Make sure you have liblua51 installed, then try
gcc -llua51 mytest.c
for dynamic linkage, or
gcc mytest.c /path/to/liblua51.a
for static linkage. These are the libraries (dynamic and static,
respectively) that provide the implementation of the lua* functions
you're calling.

HTH,
-K