簡體   English   中英

Lua 和 c++ 錯誤 windows

[英]Lua and c++ errors windows

嘿,我正在嘗試將 Lua 文件加載到我的 c++ 項目中,但是有一些錯誤我不知道如何修復...我已經從 Lua 下載了庫,並且我已經將它們放入了我的包含文件夾中。 dll 在我的項目中,而庫在我的編譯器的 lib 文件夾中,因此它不應該是 linker 錯誤。

我得到的錯誤是:

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

我不知道該怎么做。 我正在使用代碼塊,我正在使用這個 linker 參數: -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++ 版本。 那好吧

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM