1. 程式人生 > >編譯安裝libiconv報錯:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)

編譯安裝libiconv報錯:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)

編譯安裝libiconv報錯:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)

錯誤如下:

    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


解決辦法:

vi libiconv-1.14/srclib/stdio.in.h

將698行的代碼:_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


本文出自 “小菜鳥” 博客,請務必保留此出處http://baishuchao.blog.51cto.com/12918589/1936525

編譯安裝libiconv報錯:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)