开发者

Lua and c++ errors windows

开发者 https://www.devze.com 2023-03-19 05:57 出处:网络
Hey I\'m trying to load a Lua file into my c++ project but there are some errors I don\'t know how to fix... I have downloaded the libraries from Lua and I\'ve got them in my include folder. The dll\'

Hey I'm trying to load a Lua file into my c++ project but there are some errors I don't know how to fix... I have downloaded the libraries from Lua and I've got them in my include folder. The dll's are in my project and the libs are on the lib folder of my compiler so it shouldn't be a linker error.

The errors I'm getting are:

error: 'luaL_newstate' was not declared in this scope
error: 'luaL_openlibs' was not declared in this scope
error: 'luaL_dofile' was not declared in this scope

I have no idea what to do. I'm using codeblocks and I'm using this linker argument: -llua5.1

Here is my code:

lua_State *L = lua_open();
luaL_openlibs(L);

luaL_dofile(L,"ModificarViento.lua");

lua_getglobal(L,"MueveFlecha");

lua_call(L,0,2);

vientoX = (int)lua_tointeger(L,-2);
vientoX = (int)lua_toint开发者_开发问答eger(L,-1);
lua_pop(L,1);

lua_close(L);

and here are my includes of Lua

extern "C"{
    #include <lua.h>
    #include <lualib.h>
    #include <lauxlib.h>
}

If anyone knows what's wrong, please tell me.

Thank you very much!


I fixed it. I downloaded Lua for mingw32. I had the VC++ version. Oh well

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号