diff --git a/src/msmtp.c b/src/msmtp.c
index 3c21d2e..fc1d408 100644
--- a/src/msmtp.c
+++ b/src/msmtp.c
@@ -78,6 +78,8 @@ extern int optind;
 
 /* Default file names. */
 #ifdef W32_NATIVE
+#include <winsock2.h>
+
 #define SYSCONFFILE     "msmtprc.txt"
 #define USERCONFFILE    "msmtprc.txt"
 #define SYSNETRCFILE    "netrc.txt"
