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>."