diff --git a/lcm/windows/WinPorting.cpp b/lcm/windows/WinPorting.cpp
index e22acd6..b9c7e69 100644
--- a/lcm/windows/WinPorting.cpp
+++ b/lcm/windows/WinPorting.cpp
@@ -1,8 +1,8 @@
 
 #define _WIN32_WINNT 0x0501
-#include <Mswsock.h>
 #include <stdio.h>
 #include <winsock2.h>
+#include <Mswsock.h>
 
 #include "WinPorting.h"
 
diff --git a/lcmgen/emit_go.c b/lcmgen/emit_go.c
index c520044..b5be56a 100644
--- a/lcmgen/emit_go.c
+++ b/lcmgen/emit_go.c
@@ -6,8 +6,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef WIN32
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 #ifdef WIN32
+#define F_OK 0
 #define __STDC_FORMAT_MACROS  // Enable integer types
 #endif