This is expected you are not including unistd.h in your source which is required if you want to use getpid. It was a bug before GCC 4.7 that some of the C++ headers included that header file.
As documented at http://gcc.gnu.org/gcc-4.7/changes.html "Avoid polluting the global namespace by inclusion of <unistd.h>."
本文介绍了 GCC 4.7 版本中 C++ 编译器的一个变化,即避免通过包含 unistd.h 头文件来污染全局名称空间。如果使用 getpid() 函数,则需要显式包含 unistd.h 头文件。这一改变修正了早期版本中存在的一个 bug。
4万+

被折叠的 条评论
为什么被折叠?



