Added lacked include files. Added a test. Added MSVC build settings on appveyor. Added old MSVC workaround. Fixed a variable definition point to meet ANSI-C.