CentOS7下安装libiconv时报错‘gets’ undeclared here (not in a function)的解决方法

编译安装时出现下列错误,导致编译不通过。

./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”);


解决方法:

  1. 修改srclib/stdio.in.h,将_GL_WARN_ON_USE (gets, “gets is a security hole – use fgets instead”);修改为下列内容,大概在698行。

#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)

_GL_WARN_ON_USE (gets, “gets is a security hole – use fgets instead”);

#endif

修改前如下:


修改后如下:


  1. 重新configure,再make,通过。

本文链接地址: https://danteng.org/centos7-libiconvinstall-gets-undeclared-here-not-in-a-function/