Fix compiling for osx and linux and only 1 io.h

Still needs check on OSX and changes for Windows