libiconv-1.14 error: ‘gets’ undeclared here (not in a function)

centos7下编译安装libiconv-1.14报错,信息如下:

1
2
3
4
5
6
7
In file included from progname.c:26:0:
./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
  _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
  ^
make[1]: *** [progname.o] Error 1
make[1]: Leaving directory `/root/lnmp1.2/source/libiconv-1.14/srclib'
make: *** [all] Error 2

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

1
2
3
4
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,
改为:

1
2
3
#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 通过

原创文章,转载请注明。本文链接地址: http://www.rootop.org/pages/3532.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值