--- libtheora-1.1.1/examples/encoder_example.c.orig	2015-01-19 20:00:34.333600000 +0300
+++ libtheora-1.1.1/examples/encoder_example.c	2015-01-19 20:02:00.570400000 +0300
@@ -47,11 +47,12 @@
 #include "vorbis/codec.h"
 #include "vorbis/vorbisenc.h"
 
-#ifdef _WIN32
+#if defined(_WIN32)
 /*supply missing headers and functions to Win32. going to hell, I know*/
 #include <fcntl.h>
 #include <io.h>
 
+#if !defined(__MINGW64_VERSION_MAJOR)
 static double rint(double x)
 {
   if (x < 0.0)
@@ -60,6 +61,7 @@
     return (double)(int)(x + 0.5);
 }
 #endif
+#endif
 
 const char *optstring = "b:e:o:a:A:v:V:s:S:f:F:ck:d:z:\1\2\3\4";
 struct option options [] = {
