diff --git a/Geo/CellComplex.h b/Geo/CellComplex.h
index 3f6bdd09830136854a19ee3c742f534840b018eb..9507d9ce3b567e3c015681c984b80caa85eb7dc7 100644
--- a/Geo/CellComplex.h
+++ b/Geo/CellComplex.h
@@ -8,12 +8,15 @@
 #ifndef _CELLCOMPLEX_H_
 #define _CELLCOMPLEX_H_
 
+#include "GmshConfig.h"
+
+#if defined(HAVE_KBIPACK)
+
 #include <stdio.h>
 #include <string>
 #include <algorithm>
 #include <set>
 #include <queue>
-#include "GmshConfig.h"
 #include "MElement.h"
 #include "MPoint.h"
 #include "MLine.h"
@@ -29,8 +32,6 @@
 #include "GFace.h"
 #include "GVertex.h"
 
-#if defined(HAVE_KBIPACK)
-
 // Abstract class representing an elemtary cell of a cell complex.
 class Cell
 {  
diff --git a/Geo/ChainComplex.h b/Geo/ChainComplex.h
index 9eaf86976a1f331764d5e4fd2f91a680c51dd28e..c54ed874db0810061003e57343653a80f747914d 100644
--- a/Geo/ChainComplex.h
+++ b/Geo/ChainComplex.h
@@ -8,12 +8,15 @@
 #ifndef _CHAINCOMPLEX_H_
 #define _CHAINCOMPLEX_H_
 
-#include <stdio.h>
+#include "GmshConfig.h"
+
+#if defined(HAVE_KBIPACK)
+
+#include <cstdio>
 #include <string>
 #include <algorithm>
 #include <set>
 #include <queue>
-#include "GmshConfig.h"
 #include "MElement.h"
 #include "GModel.h"
 #include "GEntity.h"
@@ -22,8 +25,6 @@
 #include "GVertex.h"
 #include "CellComplex.h"
 
-#if defined(HAVE_KBIPACK)
-
 #include "gmp.h"
 extern "C" {
   #include "gmp_normal_form.h" // perhaps make c++ headers instead?