I'm trying to use Lua in C++, but I can not compile my code. I'm using the latest version of Lua, which is 5.3 at the moment. My IDE is Code::Blocks. So far I was following guides like these: https://eliasdaler.wordpress.com/2013/10/11/lua_cpp_binder/ http://gamedevgeek.com/tutorials/getting-started-with-lua/
However they don't explain much about how to set up Lua in C::B. I've downloaded both the binary zip and the source from Lua's website. I'm not sure where to put the files from the src folder. So far I've put the lauxlib.h, the lua.h, the luaconf.h and the lualib.h into the include directory, and used the following code in the main.cpp:
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
So far I'm just trying to run the following small snippet:
lua_State* L;
L = luaL_newstate();
luaL_openlibs(L);
luaL_dofile(L, "test.lua");
lua_close(L);
Yet I always get an error at the first line. The error I'm getting at the moment states that the reference is undefined to 'luaL_newstate'.
Maybe I should put some files in the lib directory from the source? Or is there anything I have to add to the 'Other linker options' in the 'Project build options' menu?
Edit:
In the mean time I've found this question: Lua 5.3 undefined references
It seems I have to put the -llua to the 'Opther linker options', but there are no .a, .so or .lib files included in the packages at lua.org.