i have a problem embedding lua to a c program. i have seen in the archive 3 posts with the same problem and none of them helped me solve my problem.
i downloaded the latest lua source code and compiled and installed it in my linux. it is installed in /usr/include /use/lib correctly . i can run lua scripts correctly.
i copy pasted an example of a simple application that uses lua
lua_State *L = lua_open();
// load the libs
//run a Lua scrip here
pri ntf("\nI am done with Lua in C++.\n");
when compiling with the command
gcc -llua test.cpp
/tmp/cciNWDif.o: In function `main':
test.cpp:(.text+0x10): undefined reference to `luaL_newstate()'
test.cpp:(.text+0x1d): undefined reference to `luaL_openlibs(lua_State*)'
test.cpp:(.text+0x2b): undefined reference to `luaL_loadfile(lua_State*, char const*)'
test.cpp:(.text+0x47): undefined reference to `lua_pcall(lua_State*, int, int, int)'
test.cpp:(.text+0x5a): undefined reference to `lua_close(lua_State*)'
/tmp/cciNWDif.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
i tried with extern c before the includes and i tr ied putting the liblua.a and the includes locally and compiling my program locally but also failed with the same output
could someone please help me
Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign up now.