Fixed several problems with headers, including non-matched ifdef.

All header files now compile cleanly with the -xc++ option.