I am try to use Lua 5.3.3 scripting in my c++ project, I am compiling with gcc, code::blocks. I get errors when I try to use Lua functions, such as newstate().
main.cpp:
#include <lua/lua.hpp>
// ...
int main()
{
lua_State *state = luaL_newstate();
lua_close(state);
// ...
return 0;
}
errors:
||=== Build: Debug in MettaRPG (compiler: GNU GCC Compiler) ===| obj\Debug\src\main.o||In function 'main':| C:\Users\user\Documents\Coding\CodeBlocks\MettaRPG\src\main.cpp|12|undefined reference to 'luaL_newstate'| C:\Users\user\Documents\Coding\CodeBlocks\MettaRPG\src\main.cpp|13|undefined reference to 'lua_close'| ||error: ld returned 1 exit status| ||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
possible duplicates:
"Undefined reference to" using Lua Did not solve my problem when I tried it. It yielded the same errors.
Lua 5.3 undefined references I am using this in my program, but it still doesn't work.
Building Lua for C++ Also doens't fix my problem.