diff --git a/ares/ares.h b/ares/ares.h
index 83a1c8e462a8f9c47fa67f6906491376b55d2d5b..18d3a724c9e845de4dc505974789f2a24fca373a 100644
--- a/ares/ares.h
+++ b/ares/ares.h
@@ -218,6 +218,7 @@ int ares_parse_ns_reply(const unsigned char *abuf, int alen,
 void ares_free_string(void *str);
 void ares_free_hostent(struct hostent *host);
 const char *ares_strerror(int code);
+int ares_getopt(int nargc, char * const nargv[], const char *ostr);
 
 #ifdef  __cplusplus
 }
diff --git a/ares/ares_getopt.c b/ares/ares_getopt.c
index 738e707387595c6e36b5fa977f883afb6cb2a9c7..a14b6da30e8af5eae179aff1ce8409b2a04b1404 100644
--- a/ares/ares_getopt.c
+++ b/ares/ares_getopt.c
@@ -44,9 +44,12 @@
  * #endif
  */
 
+#include "setup.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "ares.h"
 
 /* declarations to provide consistent linkage */
 extern char *optarg;
@@ -61,7 +64,7 @@ char  *optarg;        /* argument associated with option */
 
 #define  BADCH   (int)'?'
 #define  BADARG  (int)':'
-#define  EMSG    ""
+#define  EMSG    (char *)""
 
 /*
  * ares_getopt --