Added some VS compatibilities

Now it can seamlessly compile with both g++ and Visual Studio 2012