diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index cc4a773dd72fcbf5811d4d1224a12f250acc07ca..58d77223db2e3c30d9741ef2016c43b2f49eebed 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -1,4 +1,4 @@
-// $Id: CommandLine.cpp,v 1.129 2008-05-04 08:31:11 geuzaine Exp $
+// $Id: CommandLine.cpp,v 1.130 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -20,6 +20,7 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include <string.h>
+#include <stdlib.h>
 #include "GmshUI.h"
 #include "GmshDefines.h"
 #include "GmshVersion.h"
diff --git a/Common/Main.cpp b/Common/Main.cpp
index 79ec38e877854d65e00aab800dabb75aa6b76e65..0389c1b9ebbfa1fddd5c189643e61de8bc4bc8f4 100644
--- a/Common/Main.cpp
+++ b/Common/Main.cpp
@@ -1,4 +1,4 @@
-// $Id: Main.cpp,v 1.1 2008-05-04 08:31:11 geuzaine Exp $
+// $Id: Main.cpp,v 1.2 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include "Gmsh.h"
 #include "GModel.h"
 #include "CommandLine.h"
diff --git a/Common/SmoothData.cpp b/Common/SmoothData.cpp
index bfdd77d47b3f9981e54fb2499f40957cec125c2e..0e575487be4f3be74e3bd19c8571b45196f9f4f6 100644
--- a/Common/SmoothData.cpp
+++ b/Common/SmoothData.cpp
@@ -1,4 +1,4 @@
-// $Id: SmoothData.cpp,v 1.6 2008-03-20 11:44:02 geuzaine Exp $
+// $Id: SmoothData.cpp,v 1.7 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdio.h>
 #include "SmoothData.h"
 #include "Numeric.h"
 
diff --git a/Geo/GEdgeLoop.cpp b/Geo/GEdgeLoop.cpp
index fa36a661adc99bdd5af6fbbf2f0a005eab411587..2600a17868991f96ea8f85f2ada3601245b08b01 100644
--- a/Geo/GEdgeLoop.cpp
+++ b/Geo/GEdgeLoop.cpp
@@ -1,4 +1,4 @@
-// $Id: GEdgeLoop.cpp,v 1.14 2008-05-04 08:31:13 geuzaine Exp $
+// $Id: GEdgeLoop.cpp,v 1.15 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -20,6 +20,7 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include <algorithm>
+#include <functional>
 #include "GEdgeLoop.h"
 
 #if defined(HAVE_GMSH_EMBEDDED)
diff --git a/Geo/GEntity.cpp b/Geo/GEntity.cpp
index 80f744129363354f913eaa99b19a64b6ab1b537a..558022603ae3f68e9d1dd69e0980c66606a1290f 100644
--- a/Geo/GEntity.cpp
+++ b/Geo/GEntity.cpp
@@ -1,4 +1,4 @@
-// $Id: GEntity.cpp,v 1.20 2008-02-22 20:28:07 geuzaine Exp $
+// $Id: GEntity.cpp,v 1.21 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 //
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdio.h>
 #include "GEntity.h"
 
 #if defined(HAVE_GMSH_EMBEDDED)
diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp
index 4253f190a618bea1823e52332bc9da49397957db..2678e14afd6269e91ec6c65a6070f3db297a902c 100644
--- a/Geo/GModelIO_Geo.cpp
+++ b/Geo/GModelIO_Geo.cpp
@@ -1,4 +1,4 @@
-// $Id: GModelIO_Geo.cpp,v 1.22 2008-05-04 15:43:03 geuzaine Exp $
+// $Id: GModelIO_Geo.cpp,v 1.23 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include "GModel.h"
 #include "Geo.h"
 #include "OpenFile.h"
@@ -155,7 +156,7 @@ class writeFieldOptionGEO{
   Field *field;
  public :
   writeFieldOptionGEO(FILE *fp,Field *_field) { geo = fp ? fp : stdout; field=_field;}
-  void operator() (std::pair<const char *,FieldOption *> it)
+  void operator() (std::pair<const char *, FieldOption *> it)
   {
     std::string v;
     it.second->get_text_representation(v);
@@ -168,7 +169,7 @@ class writeFieldGEO{
   FILE *geo;
  public :
   writeFieldGEO(FILE *fp) { geo = fp ? fp : stdout; }
-  void operator() (std::pair<int, Field *> it)
+  void operator() (std::pair<const int, Field *> it)
   {
     fprintf(geo, "Field[%i] = %s;\n", it.first, it.second->get_name());
     std::for_each(it.second->options.begin(), it.second->options.end(),
diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp
index 362a30f7f570e8beb3d838e7065b8f33b2892cc5..91073a7b51ed827319effd8b5d67729cba6c00cc 100644
--- a/Geo/GModelIO_Mesh.cpp
+++ b/Geo/GModelIO_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: GModelIO_Mesh.cpp,v 1.53 2008-05-06 21:11:47 geuzaine Exp $
+// $Id: GModelIO_Mesh.cpp,v 1.54 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include <string.h>
 #include <map>
 #include <string>
diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp
index 79444952840b2547d7e6d3b869a03bb6bf67d956..e4ef0e2de4d12a3cbd7800d6441f5aa2176cb0c4 100644
--- a/Geo/MElement.cpp
+++ b/Geo/MElement.cpp
@@ -1,4 +1,4 @@
-// $Id: MElement.cpp,v 1.69 2008-06-01 09:14:21 geuzaine Exp $
+// $Id: MElement.cpp,v 1.70 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include <math.h>
 #include "MElement.h"
 #include "GEntity.h"
diff --git a/Geo/MVertex.cpp b/Geo/MVertex.cpp
index 01935f2fe2d14e6247358803d69f1b7c646b9e3f..4e775ecc2a40adfadd6900d1bae983de3717eaa3 100644
--- a/Geo/MVertex.cpp
+++ b/Geo/MVertex.cpp
@@ -1,4 +1,4 @@
-// $Id: MVertex.cpp,v 1.24 2008-05-06 21:11:47 geuzaine Exp $
+// $Id: MVertex.cpp,v 1.25 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,8 +19,8 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include <cstring>
-#include <cmath>
+#include <string.h>
+#include <math.h>
 #include "MVertex.h"
 #include "GEdge.h"
 #include "GFace.h"
diff --git a/Geo/findLinks.cpp b/Geo/findLinks.cpp
index 94f5fb445587cb9200f0c17a9d60732cf32d05d4..eefd6f1c25fc8f8db4ad7f07e14e7a3d08963748 100644
--- a/Geo/findLinks.cpp
+++ b/Geo/findLinks.cpp
@@ -1,4 +1,4 @@
-// $Id: findLinks.cpp,v 1.8 2008-05-04 08:31:14 geuzaine Exp $
+// $Id: findLinks.cpp,v 1.9 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include "Message.h"
 #include "GModel.h"
 #include "Tree.h"
diff --git a/Geo/gmshFace.cpp b/Geo/gmshFace.cpp
index 5cd383fa5427860a80edb0f4746a61aff56a70a6..c15d0979da31c5ae7cd225b876301da0429d8914 100644
--- a/Geo/gmshFace.cpp
+++ b/Geo/gmshFace.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshFace.cpp,v 1.57 2008-06-03 21:39:01 geuzaine Exp $
+// $Id: gmshFace.cpp,v 1.58 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include "GModel.h"
 #include "gmshFace.h"
 #include "Geo.h"
diff --git a/Geo/gmshRegion.cpp b/Geo/gmshRegion.cpp
index 8f830b9c24f87b0aab2ced6a971b17410b038abd..eb087d0f4720f725fd69fd5a92f401298ed306e9 100644
--- a/Geo/gmshRegion.cpp
+++ b/Geo/gmshRegion.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshRegion.cpp,v 1.22 2008-05-04 08:31:14 geuzaine Exp $
+// $Id: gmshRegion.cpp,v 1.23 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include "GModel.h"
 #include "gmshRegion.h"
 #include "Geo.h"
diff --git a/Mesh/Field.h b/Mesh/Field.h
index c98864601941d7447e1c37e8969e7a9a436dee29..33da943e2394a20e0ed4a60f6927e8cfee7affd2 100644
--- a/Mesh/Field.h
+++ b/Mesh/Field.h
@@ -91,7 +91,7 @@ class FieldFactory {
 
 class FieldManager : public std::map<int, Field*> {
  public:
-  std::map<const std::string, FieldFactory*> map_type_name;
+  std::map<std::string, FieldFactory*> map_type_name;
   void reset();
   Field *get(int id);
   Field *new_field(int id, const char *type_name);
diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index 841ead19d48dc15b36019c6d630ba4560e0ccdab..ec7e51b86c5c0cd1c492230eea5b2efae6f1ecf0 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -1,4 +1,4 @@
-// $Id: Generator.cpp,v 1.144 2008-05-06 21:11:47 geuzaine Exp $
+// $Id: Generator.cpp,v 1.145 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include "Message.h"
 #include "Numeric.h"
 #include "Context.h"
diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp
index 2759804c39f6ff99420e59a6184814658ec51d1e..d4e2938830a600c2dc5f29057197c97cda913585 100644
--- a/Mesh/meshGEdge.cpp
+++ b/Mesh/meshGEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGEdge.cpp,v 1.61 2008-05-04 08:31:16 geuzaine Exp $
+// $Id: meshGEdge.cpp,v 1.62 2008-06-05 11:52:49 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include "meshGEdge.h"
 #include "GEdge.h"
 #include "MElement.h"
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index 2b8c63e2a283c9161e708a4b65941cdae438bc06..116a55ba72e96da73ae0f7a054a47ec8e28cc81d 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFace.cpp,v 1.134 2008-05-06 21:11:47 geuzaine Exp $
+// $Id: meshGFace.cpp,v 1.135 2008-06-05 11:52:50 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 //
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include "meshGFace.h"
 #include "meshGFaceBDS.h"
 #include "meshGFaceDelaunayInsertion.h"
diff --git a/Mesh/meshGFaceBDS.cpp b/Mesh/meshGFaceBDS.cpp
index 60190d9f6f2805cd94f653daddbf86ef07af57fc..f9755e6b028cb786839135288b79b7d86b4e09c4 100644
--- a/Mesh/meshGFaceBDS.cpp
+++ b/Mesh/meshGFaceBDS.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFaceBDS.cpp,v 1.14 2008-06-03 12:43:42 remacle Exp $
+// $Id: meshGFaceBDS.cpp,v 1.15 2008-06-05 11:52:50 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include "meshGFace.h"
 #include "meshGFaceOptimize.h"
 #include "BackgroundMesh.h"
diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp
index 4bf9fc07b5cc9c4749d175ea0acc5b919735de1b..fa995cd482e2ddf9056ca8c8cb8cfbdb32f87ed0 100644
--- a/Mesh/meshGRegion.cpp
+++ b/Mesh/meshGRegion.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGRegion.cpp,v 1.47 2008-05-06 21:11:48 geuzaine Exp $
+// $Id: meshGRegion.cpp,v 1.48 2008-06-05 11:52:50 samtech Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <stdlib.h>
 #include <vector>
 #include "meshGRegion.h"
 #include "meshGRegionDelaunayInsertion.h"
diff --git a/Numeric/FunctionSpace.h b/Numeric/FunctionSpace.h
index 7726e26bc9d777f3ff567f7406f1969f207ec081..b568ea99722344f4bfb0d533ee7732bfc5646fbf 100644
--- a/Numeric/FunctionSpace.h
+++ b/Numeric/FunctionSpace.h
@@ -20,6 +20,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <math.h>
 #include <map>
 #include "GmshMatrix.h"