Some small compiling fix
See commit description for details, I'm not repeating it all here with different words.
Needs testing before we actually merge the changes in, I don't have anything besides Windows so I can't actually try this fix out for myself sadly. :(
This was originally a quick branch I made to fix a problem so that @wolfy852 could compile with Linux on some thing of his ...turned out not to be the only problem, and then I found a slightly unrelated problem altogether. So it's now a small assortment of compiling-related fixes.
Also should be merged to next, which is hopefully obvious.