GCC: Fixed warnings and problems with missing includes.

Now compiles fine again with -Wall -pedantic -Wextra