Failing to link against Lua library on Linux

I’ve compiled Lua 5.2 on Debian x86-64 with make posix, and am trying to compile the following with the command ‘gcc -ldl -llua main.c’

#include "lua.h" #include "lauxlib.h" #include "lualib.h"   int main() {   lua\_State \*L = luaL\_newstate();   luaL\_openlibs(L);   dofile("test.lua");     return 0; }

and get unresolved references to the lua functions.

I think you’re missing -llualib as linker option.

…and I think dofile is called lua_dofile( ) or luaL_dofile and if I recall correctly, it also takes the state as an argument.

this might not really be the right place for this question, as these forums are concerned with using lua for/with the corona engine not building your own engine :slight_smile:

I think you’re missing -llualib as linker option.

…and I think dofile is called lua_dofile( ) or luaL_dofile and if I recall correctly, it also takes the state as an argument.

this might not really be the right place for this question, as these forums are concerned with using lua for/with the corona engine not building your own engine :slight_smile: