lua-users home
lua-l archive

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


When I compile a program using lau  get the following error. The code
follows the below error

gcc -o test main.c -L/usr/local/lib -llua -llualib
/usr/local/lib/liblualib.a(liolib.o): In function `io_tmpname':
liolib.o(.text+0xd79): the use of `tmpnam' is dangerous, better use
`mkstemp'
/usr/local/lib/liblualib.a(lmathlib.o): In function `math_abs':
lmathlib.o(.text+0x16): undefined reference to `fabs'
/usr/local/lib/liblualib.a(lmathlib.o): In function `math_sin':
lmathlib.o(.text+0x5c): undefined reference to `sin'
/usr/local/lib/liblualib.a(lmathlib.o): In function `math_cos':
lmathlib.o(.text+0x9c): undefined reference to `cos'
/usr/local/lib/liblualib.a(lmathlib.o): In function `math_tan':
lmathlib.o(.text+0xdc): undefined reference to `tan'
/usr/local/lib/liblualib.a(lmathlib.o): In function `math_asin':
lmathlib.o(.text+0x116): undefined reference to `asin'
/usr/local/lib/liblualib.a(lmathlib.o): In function `math_acos':
lmathlib.o(.text+0x156): undefined reference to `acos'

and it goes on....

the code :

#include <lua.h>
#include <stdio.h>
#include <stdlib.h>
#include <lualib.h>
#include <math.h>
int main () {



       lua_State *L=lua_open(1000);
       lua_baselibopen(L);
       lua_iolibopen(L);
       lua_strlibopen(L);
       lua_mathlibopen(L);


       lua_dostring(L,"write(\"hi\");");


  return 1;
}


Please could you tell me what I am doing wrong.

Thanks