c++ - Lua 和 C++ 错误窗口

标签 c++ lua

嘿,我正在尝试将一个 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/

相关文章:

linq - Linq 是如何工作的(在幕后)?

c++ - 非数组类型的 "one-past-the-end"指针是 C++ 中的有效概念吗?

c++ - OpenMP 并行循环比常规循环慢得多

c++ - 用于行人识别的 tiny-dnn 错误

从 C API 在 Lua 中创建简单列表

lua - 寻找 "weak Lua registry"

c++ - 将类对象指针传递给用于初始化 C++ 的函数

c++ - 将 Java 代码助手的便利性从 Eclipse 带到 Visual Studio 2010 以用于原生 C++ 项目

lua - lua 中轻量用户数据的用例?

lua redis.call(...) 与 redis 中的相同调用不同