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

解壓執行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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章