centos7下编译安装libiconv-1.14 error: ‘gets’ undeclared here (not in a function)

今天在centos7下编译安装libiconv-1.14报错:

解决方法如下:

编辑 libiconv-1.14/srclib/stdio.h 文件,这个文件在make之后才会生成,源码中是没有的。

1007 /* It is very rare that the developer ever has full control of stdin,

1008 so any use of gets warrants an unconditional warning. Assume it is

1009 always declared, since it is required by C89. */

1010 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
第1010行,把 _GL_WARN_ON_USE (gets, “gets is a security hole – use fgets instead”); 删掉
改为:
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)

_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");

#endif
变成如下:
接下来
make && make install 通过
此条目发表在Linux分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注