./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)

时间:2021-09-27 01:48:35

解压执行configure,提示:
./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”);
报错说gets没有声明到神马神马的,请用fgets替换,在C89以上,gets是不推荐用的啦,我们在本目录中执行:
vi 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