diff --git a/libavutil/error.h b/libavutil/error.h
index 61b8e1dd06ad085a807d8611cf4cffd9005579e5..8a53b906a25068875952b92cad2a26c5c3a1db94 100644
--- a/libavutil/error.h
+++ b/libavutil/error.h
@@ -24,6 +24,9 @@
 #ifndef AVUTIL_ERROR_H
 #define AVUTIL_ERROR_H
 
+#include <errno.h>
+#include "avutil.h"
+
 /* error handling */
 #if EINVAL > 0
 #define AVERROR(e) (-(e)) /**< Returns a negative error code from a POSIX error code, to return from library functions. */