Index: /trunk/Mars/mcore/factofits.h
===================================================================
--- /trunk/Mars/mcore/factofits.h	(revision 17303)
+++ /trunk/Mars/mcore/factofits.h	(revision 17304)
@@ -8,4 +8,6 @@
 #ifndef FACTOFITS_H_
 #define FACTOFITS_H_
+
+#define GCC_VERSION (__GNUC__ * 10000  + __GNUC_MINOR__ * 100  + __GNUC_PATCHLEVEL__)
 
 #include "zofits.h"
@@ -235,5 +237,9 @@
             Checksum rawsum;
             rawsum.add((char*)(fOffsetCalibration.data()), 1024*1440*sizeof(int16_t));
+#if GCC_VERSION < 40603
+            c.SetStr("RAWSUM", std::to_string((long long unsigned int)(rawsum.val())));
+#else
             c.SetStr("RAWSUM", std::to_string(rawsum.val()));
+#endif
 
             //compress data and calculate final, compressed size
@@ -245,5 +251,5 @@
 
             //Write tile header
-            FITS::TileHeader th;
+            FITS::TileHeader th(0, 0);
             std::vector<uint16_t> seq(1, FITS::kFactHuffman16);
             FITS::Compression bh(seq, FITS::kOrderByRow);
@@ -275,5 +281,10 @@
             c.SetFloat("ZRATIO", (float)(1024*1440*2)/(float)(compressed_size));
             c.SetInt("PCOUNT", compressed_size + catalog_size);
+
+#if GCC_VERSION < 40603
+            c.SetStr("DATASUM", std::to_string((long long unsigned int)(datasum.val())));
+#else
             c.SetStr("DATASUM", std::to_string(datasum.val()));
+#endif
 
             datasum += c.WriteHeader(*this);
Index: /trunk/Mars/mcore/fits.h
===================================================================
--- /trunk/Mars/mcore/fits.h	(revision 17303)
+++ /trunk/Mars/mcore/fits.h	(revision 17304)
@@ -10,4 +10,6 @@
 #include <algorithm>
 #include <stdexcept>
+
+#define GCC_VERSION (__GNUC__ * 10000  + __GNUC_MINOR__ * 100  + __GNUC_PATCHLEVEL__)
 
 #ifndef __CINT__
@@ -549,5 +551,9 @@
     std::string Compile(const std::string &key, int16_t i=-1) const
     {
+#if GCC_VERSION < 40603
+        return i<0 ? key : key+std::to_string((long long int)(i));
+#else
         return i<0 ? key : key+std::to_string(i);
+#endif
     }
 
Index: /trunk/Mars/mcore/ofits.h
===================================================================
--- /trunk/Mars/mcore/ofits.h	(revision 17303)
+++ /trunk/Mars/mcore/ofits.h	(revision 17304)
@@ -13,4 +13,6 @@
 #include <stdexcept>
 
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+
 #ifdef __CINT__
 #define off_t size_t
@@ -95,6 +97,9 @@
 
             //transform(key.begin(), key.end(), key.begin(), toupper);
-
+#if GCC_VERSION < 40603
+            for (std::string::const_iterator c=key.begin(); c<key.end(); c++)
+#else
             for (std::string::const_iterator c=key.cbegin(); c<key.cend(); c++)
+#endif
                 if ((*c<'A' || *c>'Z') && (*c<'0' || *c>'9') && *c!='-' && *c!='_')
                 {
@@ -116,5 +121,9 @@
             comment = Trim(comment);
 
+#if GCC_VERSION < 40603
+            for (std::string::const_iterator c=key.begin(); c<key.end(); c++)
+#else
             for (std::string::const_iterator c=key.cbegin(); c<key.cend(); c++)
+#endif
                 if (*c<32 || *c>126)
                 {
@@ -587,5 +596,9 @@
 
         static const std::string allow("LABIJKEDQ");
+#if GCC_VERSION < 40603
+        if (std::find(allow.begin(), allow.end(), typechar)==allow.end())
+#else
         if (std::find(allow.cbegin(), allow.cend(), typechar)==allow.end())
+#endif
         {
             std::ostringstream sout;
@@ -610,6 +623,9 @@
         if (addHeaderKeys)
         {
+#if GCC_VERSION < 40603
+            const std::string nc = std::to_string((long long int)(fTable.num_cols));
+#else
             const std::string nc = std::to_string(fTable.num_cols);
-
+#endif
             SetStr("TFORM"+nc, type.str(), "format of "+name+" "+CommentFromType(typechar));
             SetStr("TTYPE"+nc, name, comment);
