lua-users home
lua-l archive

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


Derakon wrote:
I'm trying to get Lua properly installed using either 5.0.2 or 5.1
(i.e. whatever works) on my MacOS X box. Having spent a fair amount of
time on this, I've basically come down to this problem: a number of
functions have no defined symbols, so when I try to make my project, I
get this:
% make
g++ -g -Wall -pedantic -L/usr/local/lib -framework Cocoa -o test
main.o qux.o tolua_test.o -ltolua++ -llua -llualib
ld: Undefined symbols:
lua_open()
lua_close(lua_State*)
luaopen_base(lua_State*)
luaL_loadfile(lua_State*, char const*)
luaL_newstate()
lua_pcall(lua_State*, int, int, int)
_lua_newtable
_lua_setgcthreshold
make: *** [test] Error 1


Sounds like you are compiling part of your application
as C++ and (at least part of) your lua library as C code.

Try adding
extern "C" { }

around the place where your code includes the Lua headers.
I mean something like:

extern "C" {
#include "lua.h"
#include "lualib.h"
}

Alternatively you could (if possible) compile your application as C
code, or you could compile the whole Lua library as C++ code, if
you only use it with C++ code.

The last two missing symbols above may need some extra help,
but I hope this is a beginning

		Eero