Prevented the error handler from breaking compilation on certain platforms.

And fixed a few things like adding header ifdefs/ for pragma once support,
code style fixes, ...