diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp
index 1044a5bc8938a7ddb35b66f712be1bc574f6cd0f..6ba48241e7c42a68987f2b2a1ed1e599ece25f9f 100644
--- a/Common/OpenFile.cpp
+++ b/Common/OpenFile.cpp
@@ -170,7 +170,7 @@ int ParseFile(std::string fileName, bool close, bool warnIfMissing)
     return 0;
   }
 
-#if defined(HAVE_POST)
+#if defined(HAVE_FLTK) && defined(HAVE_POST)
   int numViewsBefore = PView::list.size();
 #endif
 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index d897f133123c918f3754d026792f8fcb364721c5..7cc0bbe45d76b8b40f6da91c007301a08b9c3f3d 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -550,8 +550,7 @@ static void PrintColorTable(int num, int diff, const char *prefix, FILE *file)
 #endif
 }
 
-//used in field options, sorry if it's already implemented somewhere else...
-static void Sanitize_String_Texi(std::string &s)
+void Sanitize_String_Texi(std::string &s)
 {
   int i = -1;
   while ((i = s.find('\n', i + 1)) >= 0){
@@ -834,9 +833,9 @@ void PrintOptionsDoc()
       it != fields.map_type_name.end(); it++){
     fprintf(file, "@item %s\n", it->first.c_str());
     Field *f = (*it->second)();
-    std::string field_description=f->getDescription();
+    std::string field_description = f->getDescription();
     Sanitize_String_Texi(field_description);
-    fprintf(file,"%s@*\n",field_description.c_str());
+    fprintf(file,"%s@*\n", field_description.c_str());
     if (!f->options.empty()) {
       fprintf(file, "Options:@*\n");
       fprintf(file, "@table @code\n");
diff --git a/Geo/GRbf.cpp b/Geo/GRbf.cpp
index 19391052b31de6a812db57bda1d5993011e38207..d747ff07135925660d5e30c48ff263402e29060f 100644
--- a/Geo/GRbf.cpp
+++ b/Geo/GRbf.cpp
@@ -907,8 +907,8 @@ void GRbf::solveHarmonicMap_sparse(linearSystem<double> &sys, int numNodes,
  // }
 
   //ANN UVtree
-  double dist_min = 1.e6;
 #if defined (HAVE_ANN)
+  double dist_min = 1.e6;
   ANNpointArray UVnodes = annAllocPts(nbNodes, 3);
   for(int i = 0; i < nbNodes; i++){
     UVnodes[i][0] = UV(i,0);
@@ -1008,8 +1008,8 @@ void GRbf::solveHarmonicMap(fullMatrix<double> Oper,
   Oper.mult(F, UV);
 
   //ANN UVtree
-  double dist_min = 1.e6;
 #if defined (HAVE_ANN)
+  double dist_min = 1.e6;
   ANNpointArray UVnodes = annAllocPts(nbNodes, 3);
   for(int i = 0; i < nbNodes; i++){
     UVnodes[i][0] = UV(i,0);
diff --git a/Geo/MElementCut.cpp b/Geo/MElementCut.cpp
index 865054fd6a4e10a5549fcfb73db3186f3b7995d6..fed554a09f950d58c55e9f539d970a276671bfdb 100644
--- a/Geo/MElementCut.cpp
+++ b/Geo/MElementCut.cpp
@@ -484,6 +484,8 @@ void MLineBorder::getIntegrationPoints(int pOrder, int *npts, IntPt **pts)
 
 //---------------------------------------- CutMesh ----------------------------
 
+#if defined(HAVE_DINTEGRATION)
+
 static void assignPhysicals(GModel *GM, std::vector<int> &gePhysicals, int reg, int dim,
                             std::map<int, std::map<int, std::string> > physicals[4],
                             std::map<int, int> &newPhysTags, int lsTag)
@@ -789,8 +791,6 @@ static void elementSplitMesh(MElement *e, fullMatrix<double> &verticesLs,
   }
 }
 
-#if defined(HAVE_DINTEGRATION)
-
 static bool equalV(MVertex *v, const DI_Point *p)
 {
   return (fabs(v->x() - p->x()) < 1.e-15 &&
diff --git a/Plugin/ExtractEdges.cpp b/Plugin/ExtractEdges.cpp
index 72f2d41d1517d373244f67a2af97088b7302c36a..4d091c6998f2f85dc769c6346d4afbf9ed546e9c 100644
--- a/Plugin/ExtractEdges.cpp
+++ b/Plugin/ExtractEdges.cpp
@@ -38,6 +38,8 @@ StringXNumber *GMSH_ExtractEdgesPlugin::getOption(int iopt)
   return &ExtractEdgesOptions_Number[iopt];
 }
 
+#if defined(HAVE_MESH)
+
 static void add_edge(edge_angle &ea, PViewDataList *data)
 {
   data->SL.push_back(ea.v1->x());
@@ -53,13 +55,12 @@ static void add_edge(edge_angle &ea, PViewDataList *data)
 
 PView *GMSH_ExtractEdgesPlugin::execute(PView *v)
 {
-#if defined(HAVE_MESH)
   std::vector<MTriangle*> elements;
-  for(GModel::fiter it = GModel::current()->firstFace(); 
+  for(GModel::fiter it = GModel::current()->firstFace();
       it != GModel::current()->lastFace(); ++it)
-    elements.insert(elements.end(), (*it)->triangles.begin(), 
+    elements.insert(elements.end(), (*it)->triangles.begin(),
                     (*it)->triangles.end());
-  
+
   if(elements.empty()){
     Msg::Error("No triangles in mesh to extract edges from");
     return 0;
@@ -77,12 +78,12 @@ PView *GMSH_ExtractEdgesPlugin::execute(PView *v)
   for(unsigned int i = 0; i < edges_detected.size(); i++){
     if(edges_detected[i].angle <= threshold) break;
     add_edge(edges_detected[i], data2);
-  } 
+  }
 
   if(ExtractEdgesOptions_Number[1].def){
     for(unsigned int i = 0; i < edges_lonly.size(); i++){
       add_edge(edges_lonly[i], data2);
-    } 
+    }
   }
 
   data2->setName("ExtractEdges");
@@ -90,8 +91,14 @@ PView *GMSH_ExtractEdgesPlugin::execute(PView *v)
   data2->finalize();
 
   return v2;
+}
+
 #else
+
+PView *GMSH_ExtractEdgesPlugin::execute(PView *v)
+{
   Msg::Error("Plugin(ExtractEdges) requires the mesh module");
   return v;
-#endif
 }
+
+#endif
diff --git a/Plugin/Triangulate.cpp b/Plugin/Triangulate.cpp
index 0a233703679f47579b02191e3d2e0e65ce2111cf..0583ed92d563cf8a3ebf6eccf28dd2888b81602c 100644
--- a/Plugin/Triangulate.cpp
+++ b/Plugin/Triangulate.cpp
@@ -49,6 +49,8 @@ StringXNumber *GMSH_TriangulatePlugin::getOption(int iopt)
   return &TriangulateOptions_Number[iopt];
 }
 
+#if defined(HAVE_MESH)
+
 class PointData : public MVertex {
  public:
   std::vector<double> v;
@@ -74,7 +76,6 @@ static void project(MVertex *v, double mat[3][3])
 
 PView *GMSH_TriangulatePlugin::execute(PView *v)
 {
-#if defined(HAVE_MESH)
   int iView = (int)TriangulateOptions_Number[0].def;
 
   PView *v1 = getView(iView, v);
@@ -181,8 +182,14 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
   data2->finalize();
 
   return v2;
+}
+
 #else
+
+PView *GMSH_TriangulatePlugin::execute(PView *v)
+{
   Msg::Error("Plugin(Triangulate) requires mesh module");
   return v;
-#endif
 }
+
+#endif