diff --git a/compat/getopt.c b/compat/getopt.c
index 3a873b27eee4a4d7fcb96b28b11bb7b82b5e1a42..c7f8ef3260e362768a3d44af8bf42cdf6f4c48c3 100644
--- a/compat/getopt.c
+++ b/compat/getopt.c
@@ -30,6 +30,9 @@
  * in the public domain.
  */
 
+#include <stdio.h>
+#include <string.h>
+
 #define EOF (-1)
 
 static int opterr = 1;