嘿,我正在尝试将一个 Lua 文件加载到我的 C++ 项目中,但是有一些错误我不知道如何修复...我已经从 Lua 下载了库并将它们放在我的包含文件夹中. dll 在我的项目中,库在我的编译器的 lib 文件夹中,因此它不应该是链接器错误。
我得到的错误是:
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
我不知道该怎么办。我正在使用代码块并且正在使用此链接器参数:-llua5.1
这是我的代码:
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_tointeger(L,-1);
lua_pop(L,1);
lua_close(L);
这是我包含的 Lua
extern "C"{
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
}
如果有人知道哪里出了问题,请告诉我。
非常感谢!
最佳答案
我修好了。我为 mingw32 下载了 Lua。我有 VC++ 版本。好吧
关于c++ - Lua 和 C++ 错误窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6620080/