g++ with python.h, how to compile
Take a look at Lucas's comment for the answer:
"To get rid of the _POSIX_C_SOURCE warning, make sure to include Python.h before all other header files."
I had the same problem. I use Boost Python, so for me I moved the include of boost/python.hpp to the first line in my .cpp file.
(Lukas, post your comment as an answer so the person who asked can mark it as the right answer, and the question won't remain 'unanswered' in StackOverflow.)