diff --git a/tools/xmlpatterns/main.cpp b/tools/xmlpatterns/main.cpp
index 0c8140c66baf8af0b67dbeb1455b8e35e60b30df..00d41b341b987313db4b57569ef084a0c454f6e0 100644
--- a/tools/xmlpatterns/main.cpp
+++ b/tools/xmlpatterns/main.cpp
@@ -52,7 +52,7 @@
 #include "qapplicationargument_p.h"
 #include "qapplicationargumentparser_p.h"
 
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && (!defined(_WIN32_WCE) || _WIN32_WCE >= 0x800)
 /* Needed for opening stdout with _fdopen & friends. io.h seems to not be
  * needed on MinGW though. */
 #include <io.h>