Fix MSVC errors and warnings
Fix macro redefinition warning