diff --git a/Mesh/meshPartition.cpp b/Mesh/meshPartition.cpp
index 98b645cc1aa8d74fab26507fb00716ab4c612234..ea84394a4b6b90f6323db0f9dd5e52fa830257d3 100644
--- a/Mesh/meshPartition.cpp
+++ b/Mesh/meshPartition.cpp
@@ -6,13 +6,13 @@
 // Partition.cpp - Copyright (C) 2008 S. Guzik, C. Geuzaine, J.-F. Remacle
 
 #include "GmshConfig.h"
+#include "meshPartition.h"
+#include "meshPartitionOptions.h"
 
 #if defined(HAVE_CHACO) || defined(HAVE_METIS)
 
 #include "GModel.h"
-#include "meshPartition.h"
 #include "meshPartitionObjects.h"
-#include "meshPartitionOptions.h"
 #include "MTriangle.h"
 #include "MQuadrangle.h"
 #include "MTetrahedron.h"
@@ -1363,4 +1363,13 @@ template void MakeGraphDIM<3, GModel::riter, GModel::fiter>
  Graph &graph, BoElemGrVec *const boElemGrVec);
 
 
+#else
+
+int PartitionMesh(GModel *const model, meshPartitionOptions &options)
+{
+  Msg::Error("Gmsh must be compiled with METIS or Chaco support to partition meshes");
+  return 0;
+}
+
+
 #endif