|
what's your compilation command line? what's your platform? are you adding the math libraries? withgcc/linux this should be included by default. -llua -ldl -lm? > Date: Fri, 9 Jan 2009 12:48:46 -0800 > From: spartan.leader@gmail.com > To: lua@bazar2.conectiva.com.br > Subject: Problem embedding lua in c > > > I am a lua newcomer and mainly want to embed lua in c. > I have followed this tutorial ( > http://gamedevgeek.com/tutorials/getting-started-with-lua/ ). > Compiling the given example as C++ works perfectly but compiling in C I get > the following error: > > /usr/local/lib/liblua.a(lvm.o): In function `Arith': > lvm.c:(.text+0xc08): undefined reference to `floor' > lvm.c:(.text+0xc38): undefined reference to `pow' > /usr/local/lib/liblua.a(lvm.o): In function `luaV_execute': > lvm.c:(.text+0x21f5): undefined reference to `floor' > lvm.c:(.text+0x2229): undefined reference to `pow' > /usr/local/lib/liblua.a(lcode.o): In function `codearith': > lcode.c:(.text+0x136c): undefined reference to `floor' > lcode.c:(.text+0x13a8): undefined reference to `pow' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_tan': > lmathlib.c:(.text+0x19e): undefined reference to `tan' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_tanh': > lmathlib.c:(.text+0x1de): undefined reference to `tanh' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_sqrt': > lmathlib.c:(.text+0x241): undefined reference to `sqrt' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_sin': > lmathlib.c:(.text+0x28e): undefined reference to `sin' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_sinh': > lmathlib.c:(.text+0x2ce): undefined reference to `sinh' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_floor': > lmathlib.c:(.text+0x43e): undefined reference to `floor' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_random': > lmathlib.c:(.text+0x537): undefined reference to `floor' > lmathlib.c:(.text+0x584): undefined reference to `floor' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_pow': > lmathlib.c:(.text+0x628): undefined reference to `pow' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_log': > lmathlib.c:(.text+0x6ce): undefined reference to `log' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_log10': > lmathlib.c:(.text+0x70e): undefined reference to `log10' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_fmod': > lmathlib.c:(.text+0x855): undefined reference to `fmod' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_exp': > lmathlib.c:(.text+0x87e): undefined reference to `exp' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_cos': > lmathlib.c:(.text+0x8be): undefined reference to `cos' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_cosh': > lmathlib.c:(.text+0x8fe): undefined reference to `cosh' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_ceil': > lmathlib.c:(.text+0x93e): undefined reference to `ceil' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_atan': > lmathlib.c:(.text+0x97e): undefined reference to `atan' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_atan2': > lmathlib.c:(.text+0x9d8): undefined reference to `atan2' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_asin': > lmathlib.c:(.text+0xa1e): undefined reference to `asin' > /usr/local/lib/liblua.a(lmathlib.o): In function `math_acos': > lmathlib.c:(.text+0xa5e): undefined reference to `acos' > collect2: ld returned 1 exit status > > I removed extern "C" and followed the instructions to the last detail. > > Can someone tell me what the problem is? > > Thanks in advance. > -- > View this message in context: http://www.nabble.com/Problem-embedding-lua-in-c-tp21380277p21380277.html > Sent from the Lua - General mailing list archive at Nabble.com. > Discover the new Windows Vista Learn more! |