Added C++ guards to .h files.
Fixed numerous C++ warnings and errors.