diff --git a/Geo/CGNSFunctions.cpp b/Geo/CGNSFunctions.cpp
index dc89c9c711ff2635702e5d8d10b749b29cd80ac0..fc6f5bede9906a7111adf79ab802f5342b3bbb6c 100644
--- a/Geo/CGNSFunctions.cpp
+++ b/Geo/CGNSFunctions.cpp
@@ -17,7 +17,11 @@
 #include "fullMatrix.h"
 #include "GmshDefines.h"
 
+namespace CGNS {
 #include <cgnslib.h>
+};
+
+  using namespace CGNS;
 
 #include <vector>
 // -----------------------------------------------------------------------------
diff --git a/Geo/GModel.h b/Geo/GModel.h
index b1cef3c9cf33ea956db0bd8b0327de21269ccc6c..ea600967593ee55ae51db3fe2aabaa0405af4447 100644
--- a/Geo/GModel.h
+++ b/Geo/GModel.h
@@ -18,6 +18,12 @@
 #include "SPoint3.h"
 #include "SBoundingBox3d.h"
 
+#ifdef HAVE_LIBCGNS
+namespace CGNS {
+#include <cgnslib.h>
+}
+#endif
+
 template <class scalar> class simpleFunction;
 
 class FM_Internals;
@@ -722,6 +728,7 @@ class GModel {
   // SU2 mesh file
   int writeSU2(const std::string &name, bool saveAll, double scalingFactor);
 
+#if defined HAVE_LIBCGNS 
 protected:
   
   int readCGNSBase(const std::string& name,int& nbases) const;
@@ -731,12 +738,13 @@ protected:
                     int fileIndex,
                     int baseIndex,
                     int zoneIndex,
-                    int nbPoints,
+                    CGNS::cgsize_t nbPoints,
                     int dim,
                     GEntity* ge,
                     int& pointIndex, 
                     std::map<int,MVertex*>& vertices);
   
+#endif
 
 };
 
diff --git a/Geo/GModelIO_CGNS.cpp b/Geo/GModelIO_CGNS.cpp
index cbd4e0ad5196b1cd6929ccb1fcd840492b5bc741..56bf13ba4e857c7e072c1e6379e2852e72d30861 100644
--- a/Geo/GModelIO_CGNS.cpp
+++ b/Geo/GModelIO_CGNS.cpp
@@ -52,9 +52,12 @@
 #include "MZone.h"
 #include "MZoneBoundary.h"
 
+namespace CGNS {
 #include <cgnslib.h>
+}
 
 using namespace std;
+  using namespace CGNS;
 
 #define maxLenCGNS 32
 
@@ -950,7 +953,7 @@ int GModel::addCGNSPoints(const string& fileName,
                           int fileIndex,
                           int baseIndex,
                           int zoneIndex,
-                          int nbPoints,int dim,
+                          cgsize_t nbPoints,int dim,
                           GEntity* entity,
                           int& index,
                           std::map<int,MVertex*>& vertices) {
@@ -972,12 +975,10 @@ int GModel::addCGNSPoints(const string& fileName,
   double* xyz = new double[nbPoints*3];
   for (int i=0;i<3*nbPoints;i++) xyz[i] = 0;
 
-  std::cout << "Reading " << nbPoints << " points " << std::endl;
-
   for (int iCoord=0;iCoord<dim;iCoord++) {
 
     char coordName[maxLenCGNS];
-    int indBeg(1);
+    cgsize_t indBeg(1);
     
     DataType_t dataType;
     if (cg_coord_info(fileIndex,baseIndex,zoneIndex, 
@@ -994,10 +995,7 @@ int GModel::addCGNSPoints(const string& fileName,
                  __FILE__,__LINE__,fileName.c_str(),cg_get_error());
       delete [] xyz;
       return 0;
-    }
-
-    std::cout << "Read coordinate " << iCoord << std::endl;
-    
+    }    
   }
   
   const double* x = xyz;
@@ -1008,18 +1006,10 @@ int GModel::addCGNSPoints(const string& fileName,
     vertices[index] = new MVertex(x[i],y[i],z[i],entity,index);
     index++;
   }
-
-  std::cout << "Created all points " << std::endl;
-  
   delete [] xyz;
-
-  std::cout << "Cleaned coordinates " << std::endl;
-  
   return 1;
 }
 
-
-
 // -----------------------------------------------------------------------------
 
 int GModel::readCGNSUnstructured(const std::string& fileName) 
@@ -1159,9 +1149,6 @@ int GModel::readCGNSUnstructured(const std::string& fileName)
       strcpy(familyName,familyString.str().c_str());
       family[familyName] = familyIndex;
     }
-
-    std::cout << "Reading zone " << zoneIndex << " on family " << familyIndex 
-              << std::endl;
     
     // --- read coordinates and create vertices
     
@@ -1188,15 +1175,13 @@ int GModel::readCGNSUnstructured(const std::string& fileName)
     }
 
     // connectivity corresponds to a given element type 
-
-    std::cout << "Read number of sections" << std::endl;
-
+    
     for (int sectIndex=1;sectIndex<=nbSections;sectIndex++) {
       
       char sectName[maxLenCGNS];
       ElementType_t cgnsType;
-      int eltBeg;
-      int eltEnd;
+      cgsize_t eltBeg;
+      cgsize_t eltEnd;
       int nbBound;
       int parentFlag;
       
@@ -1210,12 +1195,6 @@ int GModel::readCGNSUnstructured(const std::string& fileName)
       }
       
       int nbElt = eltEnd - eltBeg + 1;
-
-      std::cout << "Have " << nbElt << " elements of type " << cgnsType << " in section " << std::endl;
-      
-      // --- topological information 
-      
-      std::cout << "Got renumbering " << std::endl;
       
       // --- read connections
 
@@ -1241,8 +1220,6 @@ int GModel::readCGNSUnstructured(const std::string& fileName)
         return 0;
       }
       
-      std::cout << "Read elements " << std::endl;
-
       cgsize_t* pElt = elts;
       for (int iElt=0;iElt<nbElt;iElt++) {
         
@@ -2570,7 +2547,7 @@ int write_CGNS_zones(GModel &model, const int zoneDefinition, const int numZone,
             // In the first zone
             if(cg_conn_write
                (cgIndexFile, cgIndexBase, zoneInfo[gCIt->first.zone1].cgIndex,
-                interfaceName.c_str(), Vertex, Abutting1to1, PointList, nVert,
+                interfaceName.c_str(), CGNS::Vertex, Abutting1to1, PointList, nVert,
                 &iBuffer1[0], zoneInfo[gCIt->first.zone2].name.c_str(),
                 Unstructured, PointListDonor, Integer, nVert, &iBuffer2[0],
                 &cgIndexInterface))
@@ -2580,7 +2557,7 @@ int write_CGNS_zones(GModel &model, const int zoneDefinition, const int numZone,
             // In the second zone
             if(cg_conn_write
                (cgIndexFile, cgIndexBase, zoneInfo[gCIt->first.zone2].cgIndex,
-                interfaceName.c_str(), Vertex, Abutting1to1, PointList, nVert,
+                interfaceName.c_str(), CGNS::Vertex, Abutting1to1, PointList, nVert,
                 &iBuffer2[0], zoneInfo[gCIt->first.zone1].name.c_str(),
                 Unstructured, PointListDonor, Integer, nVert, &iBuffer1[0],
                 &cgIndexInterface))