Compiles on OS X

Specify void/int as return values from functions.
Forward declarations added.
Misc compiler errors corrected.