diff --git a/compiler2/Real.cc b/compiler2/Real.cc
index c9f5a8179783037f979b0a426e4085f1a5b19b4c..54b16ea469bf3cff306f76d17c344fc4fc68508a 100644
--- a/compiler2/Real.cc
+++ b/compiler2/Real.cc
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
+#include <cmath>
 
 namespace Common {
 
diff --git a/compiler2/Real.hh b/compiler2/Real.hh
index 1d6ebcf35df7634ade3edc84ff2281d6bdce42e0..46f9655ee7e3bf58d096ecc7270724ba25dd2ef1 100644
--- a/compiler2/Real.hh
+++ b/compiler2/Real.hh
@@ -18,7 +18,6 @@
 #define _Common_Real_HH
 
 #include "string.hh"
-#include <math.h>
 
 // older versions of gcc do not have numeric_limits<double> or it is wrong
 // and they do not have constants defined by C99 standard