【发布时间】:2016-06-15 11:39:59
【问题描述】:
我正在尝试安装SOCAT,而且我对 C++ 非常了解。所以按照HERE的说明,我可以下载最新的稳定版1.7.3.1,我通过./configure,但是当我进入./make时,我得到了以下错误:
nestlex.c:14:7: error: unknown type name ‘ptrdiff_t’
ptrdiff_t *len,
^
nestlex.c: In function ‘nestlex’:
nestlex.c:48:7: warning: implicit declaration of function ‘_nestlex’ [-Wimplicit-function-declaration]
_nestlex(addr, token, (ptrdiff_t *)len, ends, hquotes, squotes, nests,
^
nestlex.c:48:30: error: ‘ptrdiff_t’ undeclared (first use in this function)
_nestlex(addr, token, (ptrdiff_t *)len, ends, hquotes, squotes, nests,
^
nestlex.c:48:30: note: each undeclared identifier is reported only once for each function it appears in
nestlex.c:48:41: error: expected expression before ‘)’ token
_nestlex(addr, token, (ptrdiff_t *)len, ends, hquotes, squotes, nests,
^
nestlex.c: At top level:
nestlex.c:54:7: error: unknown type name ‘ptrdiff_t’
ptrdiff_t *len,
^
nestlex.c: In function ‘nestlex’:
nestlex.c:50:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *** [nestlex.o] Error 1
系统信息:
cat system-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
rpm -qa |grep gcc
libgcc-4.8.5-4.el7.x86_64
gcc-4.8.5-4.el7.x86_64
rpm -qa |grep glibc
glibc-common-2.17-106.el7_2.6.x86_64
glibc-2.17-106.el7_2.6.x86_64
glibc-devel-2.17-106.el7_2.6.x86_64
glibc-headers-2.17-106.el7_2.6.x86_64
rpm -qa |grep gd
gdisk-0.8.6-5.el7.x86_64
gd-2.0.35-26.el7.x86_64
gdbm-1.10-8.el7.x86_64
我不知道从哪里开始,因为我对必须从源代码安装相当陌生。我发现一些文章将问题描述为没有安装正确版本的标头。如果有人能指出我正确的方向,我将不胜感激。
提前致谢。
【问题讨论】:
-
一个细节:报告中唯一致命的事情是
ptrdiff_t不为人所知(错误)其余似乎是后续噪音。因此,要么在配置步骤中错误检测到所需的包含头文件,要么在 socat 源本身中出现错误。 -
打开nestlex.c,查找
#include <stddef.h>是否在其中,这是定义该类型的地方。 -
nestkex,c 有:#include "config.h" #include "mytypes.h" #include "sysincludes.h"
-
grep -R "stdef.h" * 在socat目录中不返回任何结果。
-
我添加了#include "stddef.h" 并允许它编译。谢谢@renemilk 不知道如何为您的答案表示感谢。