diff --git a/src/sand-wedge-data/mygeometry.cc b/src/sand-wedge-data/mygeometry.cc
index dedefcd8be5039bd8d6125621b38e90cea80ff13..6a22bf8150f8385d22dcb843398358b5924f356b 100644
--- a/src/sand-wedge-data/mygeometry.cc
+++ b/src/sand-wedge-data/mygeometry.cc
@@ -4,6 +4,12 @@
 
 #include <fstream>
 
+#ifdef HAVE_CAIROMM
+#include <cairomm/context.h>
+#include <cairomm/fontface.h>
+#include <cairomm/surface.h>
+#endif
+
 #include "mygeometry.hh"
 
 double MyGeometry::verticalProjection(LocalVector const &x) {
diff --git a/src/sand-wedge-data/mygeometry.hh b/src/sand-wedge-data/mygeometry.hh
index d3b122bb7ac321de0d69752caac267e87bfb0264..eea24864ca0f11a6c6bd26066eff1ea1e0ebbb6f 100644
--- a/src/sand-wedge-data/mygeometry.hh
+++ b/src/sand-wedge-data/mygeometry.hh
@@ -3,12 +3,6 @@
 
 #include <dune/common/fvector.hh>
 
-#ifdef HAVE_CAIROMM
-#include <cairomm/context.h>
-#include <cairomm/fontface.h>
-#include <cairomm/surface.h>
-#endif
-
 #include "midpoint.hh"
 
 namespace MyGeometry {