diff --git a/libavcodec/os_support.h b/libavcodec/os_support.h
index 879bc470dd5bb711438225681a8a621998ddedfb..c3b3482b69dc22a3f9b0513011ad034d5e185a58 100644
--- a/libavcodec/os_support.h
+++ b/libavcodec/os_support.h
@@ -11,6 +11,7 @@
  */
 
 #ifdef __MINGW32__
+#  undef DATADIR /* clashes with /usr/include/w32api/objidl.h */
 #  include <windows.h>
 #  define usleep(t)    Sleep((t) / 1000)
 #endif