Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot link a minimal Lua program
    primarykey
    data
    text
    <p>I have the following trivial Lua program which I copied from the book Programming In Lua</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;lua.h&gt; #include &lt;lauxlib.h&gt; #include &lt;lualib.h&gt; int main (void) { char buff[256]; int error; lua_State *L = luaL_newstate(); /* opens Lua */ luaL_openlibs(L); /* opens the standard libraries */ while (fgets(buff, sizeof(buff), stdin) != NULL) { error = luaL_loadbuffer(L, buff, strlen(buff), "line") || lua_pcall(L, 0, 0, 0); if (error) { fprintf(stderr, "%s", lua_tostring(L, -1)); lua_pop(L, 1); /* pop error message from the stack */ } } lua_close(L); return 0; } </code></pre> <p>my environment is cywin</p> <p>my make file looks like this:</p> <pre><code>CC=gcc INCLUDE='-I/home/xyz/c_drive/Program Files/Lua/5.1/include' LINKFLAGS='-L/home/xyz/c_drive/Program Files/Lua/5.1/lib' -llua51 li.o:li.c $(CC) $(INCLUDE) -c li.c main:li.o $(CC) -o main $(LINKFLAGS) li.o clean: rm *.o rm main </code></pre> <p>My /home/xyz/c_drive/Program Files/Lua/5.1/lib directory contains lua5.1.dll lua5.1.lib lua51.dll and lua51.lib</p> <p>Trying to build my main target I am getting the following errors:</p> <pre><code>li.o:li.c:(.text+0x35): undefined reference to `_luaL_newstate' li.o:li.c:(.text+0x49): undefined reference to `_luaL_openlibs' li.o:li.c:(.text+0xaf): undefined reference to `_luaL_loadbuffer' li.o:li.c:(.text+0xd9): undefined reference to `_lua_pcall' li.o:li.c:(.text+0x120): undefined reference to `_lua_tolstring' li.o:li.c:(.text+0x154): undefined reference to `_lua_settop' li.o:li.c:(.text+0x167): undefined reference to `_lua_close' </code></pre> <p>Any ideas about what I might be doing wrong here?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload