gpt4 book ai didi

linux - 构建 lsnes 时出现 "undefined lua_xxxxx"链接错误

转载 作者:太空宇宙 更新时间:2023-11-04 12:31:52 33 4
gpt4 key购买 nike

在我的 ubuntu 14.xx 中,我尝试编译 lsnes 模拟器以使用来自 aleju/mario-ai 的 mario-ai 脚本。 ,并且我尝试通过谷歌搜索许多解决方案来解决以下问题:

这是控制台的输出:

make[3]: __all__.files' is up to date.
make[3]: Leaving directory
/home/pengsuyu/software/lsnes/sourcecode/src/platform/macosx' make[2]: Leaving directory /home/pengsuyu/software/lsnes/sourcecode/src/platform'
g++ -o lsnes
cat all_common.files all_platform.files-pthread -lboost_iostreams -lboost_filesystem -lboost_system -lz -lgcrypt -lgpg-error -L/usr/lib/x86_64-linux-gnu -lcurl -rdynamic -ldlcat core/all.ldflags lua/all.ldflags fonts/all.ldflags library/all.ldflags interface/all.ldflags video/all.ldflags emulation/all.ldflags cmdhelp/all.ldflags platform/all.ldflags
core/multitrack.o: In function
lua::state::get_string(int, std::string const&)': /home/pengsuyu/software/lsnes/sourcecode/src/core/../../include/library/lua-base.hpp:317: undefined reference to lua_tolstring'
core/multitrack.o: In function
lua::state::get_bool(int, std::string const&)': /home/pengsuyu/software/lsnes/sourcecode/src/core/../../include/library/lua-base.hpp:334: undefined reference to lua_toboolean'
core/multitrack.o: In function
lua::state::type(int)': . . /home/pengsuyu/software/lsnes/sourcecode/src/library/lua.cpp:536: undefined reference to lua_close'
library/lua.o: In function
lua::state::pushcfunction(int ()(lua_State))': /home/pengsuyu/software/lsnes/sourcecode/src/library/../../include/library/lua-base.hpp:504: undefined reference to lua_pushcclosure'
library/lua.o: In function
lua::state::getfield(int, char const*)': /home/pengsuyu/software/lsnes/sourcecode/src/library/../../include/library/lua-base.hpp:506: undefined reference to lua_getfield'
library/lua.o: In function
lua::state::insert(int)': /home/pengsuyu/software/lsnes/sourcecode/src/library/../../include/library/lua-base.hpp:509: undefined reference to lua_insert'
collect2: error: ld returned 1 exit status
make[1]: *** [lsnes] Error 1
make[1]: Leaving directory
/home/pengsuyu/software/lsnes/sourcecode/src' make: *** [src/all_files] Error 2

==================================

一开始,我想,链接器找不到我的lua库。所以我试着用 test.lua 编译我的 main.cpp。

主要.cpp:

#include <stdio.h>
#include <iostream>

//extern "C"
//{
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
//} // liblua5.1-c++.a
lua_State * L;
int main ()
{
L = lua_open();
luaL_openlibs(L);
luaL_dofile(L, "d:\\test.lua");
return 0;
}

测试.lua:

print("Hello World");

我写一个 MakeFile 来生成可执行文件“main”:

main:main.o
gcc -o $@ $< -llua5.1 -lstdc++
main.o:
gcc -c main.cpp
clean:
-rm *.o

当我添加编译选项“-llua5.1”和“-lstdc++”时它起作用,否则它会抛出与我编译 lsnes 相同的错误

我不熟悉 gcc 和 Makefile。请帮我解决这个问题。

最佳答案

我已经解决了我的问题

解决这个问题的方法就是在名为“options.build”的文件中更改一行。

1. find the line "LUA=lua" in options.build

2. change this line to "LUA=lua5.1"

因为需要的库是5.1,所以如果你想成功构建它,你必须使用“lua5.1”库但是默认配置是“lua”而不是“lua5.1”

关于linux - 构建 lsnes 时出现 "undefined lua_xxxxx"链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43085652/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com