Improve compilation on Visual Studio 2013

The main branch does not compile on Visual Studio 2013. 

My changes fix most of the issues. A few still exist:

1. regex.h is missing from Visual Studio, code should be modified to use the C++ regex module anyway. 
2. The JSON formatter doesn't link, complaining about multiple definitions of std::string.