c - luasocket.c :20:17: error: lua. h: 没有那个文件或目录

标签 c lua luasocket

我正在为 Lua 安装 luasocket 模块,但我收到以下错误消息:

[root@localhost local]# wget http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2/luasocket-2.0.2.tar.gz
[root@localhost local]# tar zxvf luasocket-2.0.2.tar.gz
[root@localhost local]# cd luasocket-2.0.2
[root@localhost luasocket-2.0.2]# make && make install
cd src; make all
make[1]: Entering directory `/usr/local/luasocket-2.0.2/src'
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o luasocket.o luasocket.c
luasocket.c:20:17: error: lua.h: No such file or directory
luasocket.c:21:21: error: lauxlib.h: No such file or directory
luasocket.c:24:24: error: compat-5.1.h: No such file or directory
In file included from luasocket.c:30:
luasocket.h:30: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:31:
auxiliar.h:37: error: expected ‘)’ before ‘*’ token
auxiliar.h:38: error: expected ‘)’ before ‘*’ token
auxiliar.h:39: error: expected ‘)’ before ‘*’ token
auxiliar.h:40: error: expected ‘)’ before ‘*’ token
auxiliar.h:41: error: expected ‘)’ before ‘*’ token
auxiliar.h:42: error: expected ‘)’ before ‘*’ token
auxiliar.h:43: error: expected ‘)’ before ‘*’ token
auxiliar.h:44: error: expected ‘)’ before ‘*’ token
auxiliar.h:45: error: expected ‘)’ before ‘*’ token
auxiliar.h:46: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:32:
except.h:33: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:33:
timeout.h:19: error: expected ‘)’ before ‘*’ token
timeout.h:26: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:34:
buffer.h:39: error: expected ‘)’ before ‘*’ token
buffer.h:41: error: expected ‘)’ before ‘*’ token
buffer.h:42: error: expected ‘)’ before ‘*’ token
buffer.h:43: error: expected ‘)’ before ‘*’ token
buffer.h:44: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:35:
inet.h:27: error: expected ‘)’ before ‘*’ token
inet.h:35: error: expected ‘)’ before ‘*’ token
inet.h:36: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:36:
tcp.h:34: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:37:
udp.h:31: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:38:
select.h:15: error: expected ‘)’ before ‘*’ token
luasocket.c:43: error: expected ‘)’ before ‘*’ token
luasocket.c:44: error: expected ‘)’ before ‘*’ token
luasocket.c:45: error: expected ‘)’ before ‘*’ token
luasocket.c:50: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mod’
luasocket.c:60: warning: ISO C does not allow extra ‘;’ outside of a function
luasocket.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘func’
luasocket.c:66: warning: ISO C does not allow extra ‘;’ outside of a function
luasocket.c:71: error: expected ‘)’ before ‘*’ token
luasocket.c:80: error: expected ‘)’ before ‘*’ token
luasocket.c:89: error: expected ‘)’ before ‘*’ token
luasocket.c:113: error: expected ‘)’ before ‘*’ token
make[1]: *** [luasocket.o] Error 1
make[1]: Leaving directory `/usr/local/luasocket-2.0.2/src'
make: *** [all] Error 2

有人能帮帮我吗?提前致谢:)

最佳答案

您将需要设置 LUAINC

因为你没有指定你使用的是哪个操作系统,我不能给你一个 明确的答案将其设置为什么。在 Debian 上,如果你想构建 对于Lua5.1,设置为-I/usr/include/lua5.1/

您可以通过编辑 config 来设置变量(它包含在 makefile) 或者在命令行中指定:

$ make LUAINC=-I/usr/include/lua5.1/

关于c - luasocket.c :20:17: error: lua. h: 没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20490854/

相关文章:

c - 在 C 语言中翻转句子中的单个单词?

MediaWiki 上的 Lua 错误

c - C语言中的10^500使用哪种数据类型

lua - 免费的国际象棋人工智能库,最好是 Lua 语言(或者可以轻松翻译为 Lua 的语言)?

opengl - 具有养育问题的骨骼动画

https - 使用 Lua 获取 HTTPS 页面内容

lua - 使用bind()创建带有Lua Socket的服务器

twitter - 如何在Lua中使用OAUTH发送POST请求

c - 使用按位运算符进行快速字符串搜索

C - 图形,无法旋转多边形