diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index 6a490518401d472f46f8c380c5e5c6e3f2421551..b0f3838a4e8406e5a8647801c733636d73cdfc85 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -379,8 +379,8 @@ QString CppPreprocessor::tryIncludeFile(QString &fileName, IncludeType type)
         }
     }
 
-    foreach (const QString &includePath, m_includePaths) {
-        QString path = includePath;
+    for (int i = m_includePaths.size() - 1; i != -1; --i) {
+        QString path = m_includePaths.at(i);
         path += QLatin1Char('/');
         path += fileName;
         path = QDir::cleanPath(path);