'gets' undeclared here (not in a function)

原文:http://www.cnblogs.com/hjj801006/p/3988220.html

1、在命令行输入:find -name stdio.in.h。查到有两个文件中含有stdio.in.h.

./huangwork/atom-sdk/install_sdk/IntelCE-0.34.13452.340510/project_build_i686/IntelCE/autotools-0.29.12293.323798/building/m4-1.4.13/lib/stdio.in.h
./huangwork/atom-sdk/install_sdk/IntelCE-0.34.13452.340510/project_build_i686/IntelCE/bison-0.29.12232.321541/bison-2.4.2/lib/stdio.in.h
 
2、打开第一个文件中的stdio.in.h,没有找到
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
打开第二个找到了。
然后
-_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
 #endif

即:把第一行注释掉,所以用-表示注释,然后添加第二行和第三行。最后不要忘了添加#endif。
3、编译,通过!!!!
posted @ 2016-12-28 19:58  djiankuo  阅读(1585)  评论(0编辑  收藏  举报