Add conditional compilation directives to fix build on windows

Fix a compile error on windows.