I am attempting to follow the besic guide given here on embedding lua into C. I copied the code verbatim into my own embed.c file and executed the exact compiler command listed:
cc -o embed embed.c \
-I/usr/local/include \
-L/usr/local/lib \
-llua -llualib
I get the error:
embed.c:19:14: error: invalid storage class for function ‘openlualibs’
After which I moved the functions outside of main, compiled again, and got:
/usr/bin/ld: cannot find -llualib
I am at a loss for why I cannot compile this. lua is installed properly. has anyone else encountered these problems? If this is a bad tutorial, please feel free to simply direct me to a batter one.
On some Linux distributions you may need to install the
lua-devel(or similar named) package, in order to get the proper header files and library symlinks required for compiling and linking projects against the package. If you do have aliblualib-<version>.so.<version>, for exampleliblualib-5.so.5.0, you may need to install the devel package.Starting with lua 5.1,
liblualibdoes not exist. Here is the release announcement: http://lua-users.org/lists/lua-l/2005-05/msg00186.html