gnucash master: Fix build on older versions of gcc

John Ralls jralls at code.gnucash.org
Sun Dec 7 16:58:08 EST 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/4654f49d (commit)
	from  https://github.com/Gnucash/gnucash/commit/495c939c (commit)



commit 4654f49d5c36832fb65505872cb10b9b21c58f2d
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Dec 7 13:57:55 2014 -0800

    Fix build on older versions of gcc
    
    Gcc 4.7 thinks there's a conflict with C99 stdint macros and C++, even with -std=c++11.

diff --git a/src/libqof/qof/gnc-int128.cpp b/src/libqof/qof/gnc-int128.cpp
index 3b9997c..0bcdc5f 100644
--- a/src/libqof/qof/gnc-int128.cpp
+++ b/src/libqof/qof/gnc-int128.cpp
@@ -24,7 +24,6 @@
 extern "C"
 {
 #include "config.h"
-#include <inttypes.h>
 }
 
 #include "gnc-int128.hpp"
@@ -920,4 +919,3 @@ operator>> (GncInt128 a, uint b) noexcept
     a >>= b;
     return a;
 }
-
diff --git a/src/libqof/qof/gnc-int128.hpp b/src/libqof/qof/gnc-int128.hpp
index efbfdba..0cfab84 100644
--- a/src/libqof/qof/gnc-int128.hpp
+++ b/src/libqof/qof/gnc-int128.hpp
@@ -25,7 +25,13 @@
 #ifndef GNCINT128_H
 #define GNCINT128_H
 
-#include <stdint.h>
+extern "C"
+{
+#define  __STDC_LIMIT_MACROS 1
+#define  __STDC_CONSTANT_MACROS 1
+#define  __STDC_FORMAT_MACROS 1
+#include <inttypes.h>
+}
 
 #include <stdexcept>
 #include <string>
@@ -248,7 +254,6 @@ GncInt128 gcd (int64_t a, int64_t b);
 /** Compute the least common multiple of two integers
  */
 GncInt128 lcm (int64_t a, int64_t b);
-
 #endif //GNCINT128_H
 
 /** @} */



Summary of changes:
 src/libqof/qof/gnc-int128.cpp | 2 --
 src/libqof/qof/gnc-int128.hpp | 9 +++++++--
 2 files changed, 7 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list