本文主要是介绍编译安装libiconv报错:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1. libiconv编译时遇到以下报错
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[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
2. 解决问题
2.1 使用 find 查找并编辑 stion.in.h文件
[root@Tubao libiconv]# find / -name 'stdio.in.h'
/server/tools/libiconv-1.14/srclib/stdio.in.h
2.2 通过关键字 gets 找到698 行,将其和695行一同注释
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
2.4 整体效果图,从695到702行
这篇关于编译安装libiconv报错:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!