diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp
index a66e79c6f7dab4143315cf1a8f07346255ca0809..97ce00058903f6d33457d5c1c1431ee52d676ad0 100644
--- a/Mesh/BackgroundMesh.cpp
+++ b/Mesh/BackgroundMesh.cpp
@@ -9,6 +9,7 @@
 #include "Context.h"
 #include "GVertex.h"
 #include "GEdge.h"
+#include "GEdgeCompound.h"
 #include "GFace.h"
 #include "GFaceCompound.h"
 #include "GModel.h"
diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp
index 0f2b2f82a61d76a2239a83a0702cab11f7f1fdb7..019cbf1a2cbd5e766d651acbfc30ef7534553351 100644
--- a/Mesh/Field.cpp
+++ b/Mesh/Field.cpp
@@ -1674,15 +1674,17 @@ class AttractorField : public Field
   }
 };
 
-const char *BoundaryLayerField ::getName()
+const char *BoundaryLayerField::getName()
 {
   return "BoundaryLayer";
 }
-std::string BoundaryLayerField :: getDescription()
+
+std::string BoundaryLayerField::getDescription()
 {
   return "hwall * ratio^(dist/hwall)";
 }
-BoundaryLayerField :: BoundaryLayerField()
+
+BoundaryLayerField::BoundaryLayerField()
 {
   hwall_n = .1;
   hwall_t = .5;
@@ -1711,7 +1713,7 @@ BoundaryLayerField :: BoundaryLayerField()
     (thickness, "Maximal thickness of the boundary layer");
 }
 
-double BoundaryLayerField :: operator() (double x, double y, double z, GEntity *ge)
+double BoundaryLayerField::operator() (double x, double y, double z, GEntity *ge)
 {
   double dist = 1.e22;
   AttractorField *cc;
@@ -1732,9 +1734,9 @@ double BoundaryLayerField :: operator() (double x, double y, double z, GEntity *
   return std::min (hfar,lc);
 }
 
-void BoundaryLayerField :: operator() (AttractorField *cc, double dist,
-                                       double x, double y, double z, 
-                                       SMetric3 &metr, GEntity *ge)
+void BoundaryLayerField::operator() (AttractorField *cc, double dist,
+                                     double x, double y, double z, 
+                                     SMetric3 &metr, GEntity *ge)
 {
   // dist = hwall -> lc = hwall * ratio
   // dist = hwall (1+ratio) -> lc = hwall ratio ^ 2
@@ -1869,8 +1871,8 @@ void BoundaryLayerField :: operator() (AttractorField *cc, double dist,
   metr  = SMetric3(1./(L1*L1), 1./(L2*L2), 1./(L3*L3), t1, t2, t3);
 }
 
-void BoundaryLayerField :: operator() (double x, double y, double z, 
-                                       SMetric3 &metr, GEntity *ge)
+void BoundaryLayerField::operator() (double x, double y, double z, 
+                                     SMetric3 &metr, GEntity *ge)
 {
   if (update_needed){
     for(std::list<int>::iterator it = nodes_id.begin();
@@ -1964,9 +1966,9 @@ FieldManager::~FieldManager()
     delete it->second;
 }
 
-#if defined(HAVE_POST)
 void Field::putOnNewView()
 {
+#if defined(HAVE_POST)
   if(GModel::current()->getMeshStatus() < 1){
     Msg::Error("No mesh available to create the view: please mesh your model!");
     return;
@@ -1984,8 +1986,10 @@ void Field::putOnNewView()
   oss << "Field " << id;
   PView *view = new PView(oss.str(), "NodeData", GModel::current(), d);
   view->setChanged(true);
+#endif
 }
 
+#if defined(HAVE_POST)
 void Field::putOnView(PView *view, int comp)
 {
   PViewData *data = view->getData();
diff --git a/Mesh/Field.h b/Mesh/Field.h
index 9c96953e866c55c158ff4692fec98780f4e28171..c27bd596811f0cb7bd47abf9f3efc343629529be 100644
--- a/Mesh/Field.h
+++ b/Mesh/Field.h
@@ -74,8 +74,8 @@ class Field {
   virtual const char *getName() = 0;
 #if defined(HAVE_POST)
   void putOnView(PView * view, int comp = -1);
-  void putOnNewView();
 #endif
+  void putOnNewView();
   virtual std::string getDescription(){ return ""; }
 };
 
@@ -106,13 +106,15 @@ class FieldManager : public std::map<int, Field*> {
 // extrusion)
 
 #if defined(HAVE_ANN)
-class AttractorField;// : public Field;
+class AttractorField;
 
 class BoundaryLayerField : public Field {
+ private:
   std::list<AttractorField *> _att_fields;
   std::list<int> nodes_id, edges_id, faces_id;
-  void operator() (AttractorField *cc, double dist, double x, double y, double z, SMetric3 &metr, GEntity *ge);
-public:
+  void operator() (AttractorField *cc, double dist, double x, double y, double z,
+                   SMetric3 &metr, GEntity *ge);
+ public:
   double hwall_n,hwall_t,ratio,hfar,thickness; 
   double current_distance;
   SPoint3 _closest_point;
diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp
index aa9bf3c12e12e1c3cd9620c7e19730f14e6bc033..44293b86b92c292fb96a2f2f039b7a784f38e4b5 100644
--- a/Mesh/meshGEdge.cpp
+++ b/Mesh/meshGEdge.cpp
@@ -3,6 +3,7 @@
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to <gmsh@geuz.org>.
 
+#include "GmshConfig.h"
 #include "GModel.h"
 #include "meshGEdge.h"
 #include "GEdge.h"
@@ -251,14 +252,16 @@ static void printFandPrimitive(int tag, std::vector<IntPoint> &Points)
 
 void meshGEdge::operator() (GEdge *ge) 
 {  
-
+#if defined(HAVE_ANN)
   FieldManager *fields = ge->model()->getFields();
   BoundaryLayerField *blf = 0;
   if(fields->background_field > 0){
     Field *bl_field = fields->get(fields->background_field);
     blf = dynamic_cast<BoundaryLayerField*> (bl_field);
   }
-
+#else
+  bool blf = false;
+#endif
 
   ge->model()->setCurrentMeshEntity(ge);
 
diff --git a/Mesh/meshGFaceBoundaryLayers.cpp b/Mesh/meshGFaceBoundaryLayers.cpp
index 3cb65b70ec7445436ce3701fa4a8e9a148808c57..a946f0b7b65902ef47a4cce52a17ad9362721013 100644
--- a/Mesh/meshGFaceBoundaryLayers.cpp
+++ b/Mesh/meshGFaceBoundaryLayers.cpp
@@ -96,8 +96,11 @@ void buildMeshMetric(GFace *gf, double *uv, SMetric3 &m, double metric[3])
   metric[2] = res[1][1];
 } 
 
-BoundaryLayerColumns* buidAdditionalPoints2D (GFace *gf, double _treshold) {
-
+BoundaryLayerColumns* buidAdditionalPoints2D (GFace *gf, double _treshold)
+{
+#if !defined(HAVE_ANN)
+  return 0;
+#else
   FieldManager *fields = gf->model()->getFields();
   if(fields->boundaryLayer_field <= 0){
     return 0;
@@ -106,7 +109,6 @@ BoundaryLayerColumns* buidAdditionalPoints2D (GFace *gf, double _treshold) {
   BoundaryLayerField *blf = dynamic_cast<BoundaryLayerField*> (bl_field);
   
   if (!blf)return 0;
-  
 
   BoundaryLayerColumns * _columns = new BoundaryLayerColumns;
 
@@ -387,6 +389,7 @@ BoundaryLayerColumns* buidAdditionalPoints2D (GFace *gf, double _treshold) {
   // END OF DEBUG STUFF
 
   return _columns;
+#endif
 }
 
 
diff --git a/contrib/Netgen/README.txt b/contrib/Netgen/README.txt
index 88efbac48a500d8da19ac9dcddbadf15fcdc52bc..573548e036d9c6da4fc0c4f1e95553081dfc05e8 100644
--- a/contrib/Netgen/README.txt
+++ b/contrib/Netgen/README.txt
@@ -5,11 +5,14 @@ The libsrc and nglib directories are unmodified copies taken from
 "svn co https://netgen-mesher.svn.sourceforge.net/svnroot/netgen-mesher"
 (svn revision 469), with the following exceptions:
 
-* dllexport/dllimport directives have been removed from 
+* removed dllexport/dllimport #defines from
      nglib/nglib.h
      libsrc/interface/nginterface.h
      libsrc/interface/mydefs.hpp
-* removed #include <config.h> from libsrc/includes/mystdlib.h
-* nglib_gmsh.cpp reimplements parts of nglib/nglib.cpp
+* removed #include <config.h> from 
+     libsrc/includes/mystdlib.h
+
+The nglib_gmsh.cpp file in this directory reimplements the parts of
+nglib/nglib.cpp that Gmsh relies on.
 
 See the LICENSE file for license information.