Compile fix for OSX

This adds a number of checks to make the SDK compile under OSX.

ps. I didn't bother with the world demo. Should it not perhaps just be deleted?