一、错误现象
环境 Ubuntu14.04 64位 编译 libiconv-1.14 出错
错误现象:
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] 错误 1
make[2]:正在离开目录 `/home/bupt/miao/box/soft/libiconv-1.14/srclib'
make[1]: *** [all] 错误 2
make[1]:正在离开目录 `/home/bupt/miao/box/soft/libiconv-1.14/srclib'
make: *** [all] 错误 2
二、解决方法
在libiconv-1.14/srclib/stdio.in.h 中把
_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
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
重新编译libiconv就OK了.
本文介绍了解决在Ubuntu14.04环境下编译libiconv-1.14过程中遇到的一个编译错误的方法。错误出现在stdio.h文件中,提示'gets'未声明。通过修改stdio.in.h文件中的特定代码行,可以成功解决问题并完成编译。
584

被折叠的 条评论
为什么被折叠?



