Linux 链接错误与“;未定义的lua“xxxxx”;在构建LSNE时
在我的Ubuntu14.xx中,我尝试编译lsnes emulator以使用来自的mario ai脚本,并尝试通过谷歌搜索许多解决方案来解决以下问题: 以下是控制台的输出: make[3]:Linux 链接错误与“;未定义的lua“xxxxx”;在构建LSNE时,linux,hyperlink,lua,Linux,Hyperlink,Lua,在我的Ubuntu14.xx中,我尝试编译lsnes emulator以使用来自的mario ai脚本,并尝试通过谷歌搜索许多解决方案来解决以下问题: 以下是控制台的输出: make[3]:所有文件都是最新的。 make[3]:离开目录/home/pengsuyu/software/lsnes/sourcecode/src/platform/macosx' make[2]:离开目录/home/pengsuyu/software/lsnes/sourcecode/src/platform' g++
所有文件都是最新的。
make[3]:离开目录
/home/pengsuyu/software/lsnes/sourcecode/src/platform/macosx'
make[2]:离开目录/home/pengsuyu/software/lsnes/sourcecode/src/platform'
g++-o lsnes
cat所有通用文件所有平台文件-pthread-lboost\u iostreams-lboost\u文件系统-lboost\u系统-lz-lgcrypt-lgpg错误-L/usr/lib/x86\u 64-linux-gnu-lcurl-rdynamic-ldl
cat-core/所有.ldflags lua/所有所有字体库/所有.ldflags接口/所有.ldflags视频/所有.ldflags仿真/所有.ldflags cmdhelp/所有.ldflags平台/所有.ldflags
core/multitrack.o:在函数中
lua::state::get_string(int,std::string const&'):
/home/pengsuyu/software/lsnes/sourcecode/src/core/./../include/library/lua base.hpp:317:对lua\u-tolstring'的未定义引用
core/multi-track.o:在函数中
lua::state::get_bool(int,std::string const&'):
/home/pengsuyu/software/lsnes/sourcecode/src/core/./../include/library/lua base.hpp:334:未定义对lua\u toboolean'的引用
core/multi-track.o:在函数中
lua::state::type(int)':
.
.
/home/pengsuyu/software/lsnes/sourcecode/src/library/lua.cpp:536:未定义对lua\u 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:对lua\u 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:对lua\u getfield'的未定义引用
库/lua.o:In函数
lua::state::insert(int)':
/home/pengsuyu/software/lsnes/sourcecode/src/library/./../include/library/lua base.hpp:509:未定义的对lua\u insert'的引用
collect2:错误:ld返回了1个退出状态
生成[1]:***[lsnes]错误1
make[1]:离开目录
/home/pengsuyu/software/lsnes/sourcecode/src'
make:**[src/所有_文件]错误2
==================================
一开始,我认为链接器找不到我的lua库。所以我试着用test.lua编译main.cpp
main.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;
}
我编写一个MakeFile来生成可执行文件“main”:
main:main.o
gcc-o$@$<-llua5.1-lstdc++
main.o:
gcc-c main.cpp
清洁:
-rm*.o
当我添加编译选项“-llua5.1”和“-lstdc++”时,它会工作,否则它会抛出与我编译lsnes相同的错误
我不熟悉gcc和Makefile。请帮我解决这个问题。我的问题已经解决了
解决这个问题的方法就是在名为“options.build”的文件中更改一行
因为所需的库是5.1,所以如果要成功构建它,必须使用“lua5.1”库,但是默认配置是“lua”而不是“lua5.1”
print("Hello World");
main:main.o
gcc -o $@ $< -llua5.1 -lstdc++
main.o:
gcc -c main.cpp
clean:
-rm *.o
1. find the line "LUA=lua" in options.build
2. change this line to "LUA=lua5.1"