安装libiconv报错:./stdio.h:1010:1: 错误:‘gets’未声明(不在函数内)

此处只是对编译libiconv时一个报错做个记录。编译报错如下:

gcc -DHAVE_CONFIG_H -DEXEEXT=\”\” -I. -I.. -I../lib  -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1   -g -O2 -c progname.c

In file included from progname.c:26:0:

./stdio.h:1010:1: 错误:‘gets’未声明(不在函数内)

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

 ^

make[2]: *** [progname.o] 错误 1

make[2]: 离开目录“/usr/local/src/libiconv-1.14/srclib”

make[1]: *** [all] 错误 2

make[1]: 离开目录“/usr/local/src/libiconv-1.14/srclib”

make: *** [all] 错误 2

根据报错提示,进入srclib目录修改stdio.in.h:

1、删除gets is a security此行

2、或者直接执行下:进入srclib目录 sed -i -e ‘/gets is a security/d’ ./stdio.in.h