diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 5bd9903da1421cf5676267f36ff3dc8a5300c194..bee7689535ede0d598b400352e3c81ef4d2471de 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -145,8 +145,10 @@ Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0;
 static QString qfsPrivateCurrentDir = QLatin1String("");
 // As none of the functions we try to resolve do exist on Windows CE
 // we use QT_NO_LIBRARY to shorten everything up a little bit.
+#ifndef QT_NO_LIBRARY
 #define QT_NO_LIBRARY 1
 #endif
+#endif
 
 #if !defined(QT_NO_LIBRARY)
 QT_BEGIN_INCLUDE_NAMESPACE
diff --git a/src/corelib/plugin/qlibrary.h b/src/corelib/plugin/qlibrary.h
index 5c81e6af1ac31ac2f89d8bfd8b85e4eba68f88fe..865bb8c3e3d2df94ecd3c89ae3b226d0ba45bb3b 100644
--- a/src/corelib/plugin/qlibrary.h
+++ b/src/corelib/plugin/qlibrary.h
@@ -46,12 +46,6 @@
 
 QT_BEGIN_NAMESPACE
 
-
-#if defined(QT_NO_LIBRARY) && defined(Q_OS_WIN)
-#undef QT_NO_LIBRARY
-#pragma message("QT_NO_LIBRARY is not supported on Windows")
-#endif
-
 #ifndef QT_NO_LIBRARY
 
 class QLibraryPrivate;
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index f066ff2df46b1ca984abc40c5aae9a11711b4a6a..16445f1163c07d9d16932085fc9696858fc5193b 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -46,10 +46,7 @@
 #include "qfileinfo.h"
 #include <private/qfilesystementry_p.h>
 
-#if defined(QT_NO_LIBRARY) && defined(Q_OS_WIN)
-#undef QT_NO_LIBRARY
-#pragma message("QT_NO_LIBRARY is not supported on Windows")
-#endif
+#ifndef QT_NO_LIBRARY
 
 #include <qt_windows.h>
 
@@ -166,3 +163,5 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
     return QFunctionPointer(address);
 }
 QT_END_NAMESPACE
+
+#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h
index 3d1d2dbe0b57a9aafacfe173626a199de2887008..8f8833e839198331ee40d6b72e90f23c12e5bd74 100644
--- a/src/corelib/plugin/qpluginloader.h
+++ b/src/corelib/plugin/qpluginloader.h
@@ -44,11 +44,6 @@
 
 #include <QtCore/qlibrary.h>
 
-#if defined(QT_NO_LIBRARY) && defined(Q_OS_WIN)
-#undef QT_NO_LIBRARY
-#pragma message("QT_NO_LIBRARY is not supported on Windows")
-#endif
-
 #ifndef QT_NO_LIBRARY
 
 QT_BEGIN_NAMESPACE