微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

链接错误与“undefined lua_xxxxx”build立lsnes时

在我的Ubuntu 14.xx中,我尝试编译lsnes模拟器来使用来自aleju / mario-ai的mario-ai脚本,并且我试着谷歌许多解决scheme来解决下面的问题:

这是来自控制台的输出

make [3]: __all__.files' is up to date. make[3]: Leaving directory __all__.files' is up to date. make[3]: Leaving directory / home / pengsuyu / software / lsnes / sourcecode / src / platform / macosx'make [2]:离开目录/home/pengsuyu/software/lsnes/sourcecode/src/platform' g++ -o lsnes cat all_common@H_404_8@ .files all_platform@H_404_8@ .files -pthread -lboost_iostreams -lboost_filesystem -lboost_system -lz -lgcrypt -lgpg-error -L/usr/lib/x86_64-linux-gnu -lcurl -rdynamic -ldl cat core / all@H_404_8@ .ldflags lua / all@H_404_8@ .ldflags fonts / all@H_404_8@ .ldflags library / all@H_404_8@ .ldflags interface / all@H_404_8@ .ldflags video / all@H_404_8@ .ldflags emulation / all@H_404_8@ .ldflags cmdhelp / all@H_404_8@ .ldflags platform / all@H_404_8@ .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引用lua_tolstring 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引用lua_toboolean' core/multitrack.o: In function lua :: state :: type(int)':。 。 /home/pengsuyu/software/lsnes/sourcecode/src/library/lua.cpp:536:undefined引用lua_close' library/lua.o: In function lua :: state :: pushcfunction(int( )(lua_State ))' : lua_pushcclosure' library/lua.o: In function lua lua_pushcclosure' library/lua.o: In function :504:undefined参考lua_pushcclosure' library/lua.o: In function lua :: state :: getfield(int,char const *)':/home/ lua_getfield' library/lua.o: In function :506:对lua_getfield' library/lua.o: In function undefined引用lua_getfield' library/lua.o: In function lua :: state :: insert(int)': lua_getfield' library/lua.o: In function lua-base。 hpp:509:未定义的参考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@H_404_8@ ]错误2

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

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

main.cpp中:

R / Windows / Cygwin链接

如何解决'collect2:ld返回1退出状态'?

如何获得在Linux下支持的Desktop类?

链接到MessageBox VC ++ 2008 Windows XP中的文件

如何使OpenCV在Windows下工作?

#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; }

test.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。 请帮我解决这个问题。

svn与硬链接

如何使用JavaScript打开多个独立的浏览器窗口?

我们如何使Windows上的Windows资源pipe理器打开一个FTP链接

遵循symlink从当前目录运行

PHP:识别Windows上的连接点(PHP5 / Apache 2.4)

解决了我的问题

解决这个问题的方法只是改变名为“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”

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐