In Antwort auf:
But try including unistd.h.


That resolved the problem. But i wonder why g++ needs the unistd.h header while gcc doesn't need it?