编译安装libiconv报错:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)

错误如下:

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


解决办法:

1
vi libiconv-1.14/srclib/stdio.in.h

将698行的代码:_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");替换为:

1
2
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");#endif


上一篇:ZooKeeper分布式入门实战(三)-基本特性


下一篇:SpannableString 给TextView添加不同的显示样式