gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Mon Jan 23 15:54:48 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/046e4a15 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/dd249741 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/60c06deb (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1cec0cb3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/062f3fb1 (commit)



commit 046e4a156e03e7f0549941b6db54cfa60f52cb0e
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jan 23 12:34:17 2023 -0800

    Silence Clang deprecation warnings about sprintf.

diff --git a/gnucash/gnome/gnc-plugin-page-report.cpp b/gnucash/gnome/gnc-plugin-page-report.cpp
index 184a7971a..7c1ba12b8 100644
--- a/gnucash/gnome/gnc-plugin-page-report.cpp
+++ b/gnucash/gnome/gnc-plugin-page-report.cpp
@@ -1927,7 +1927,7 @@ static gchar *report_create_jobname(GncPluginPageReportPrivate *priv)
 
     if (report_name && job_date)
     {
-        // Look up the sprintf format of the output name from the preferences database
+        // Look up the printf format of the output name from the preferences database
         char* format = gnc_prefs_get_string(GNC_PREFS_GROUP_REPORT_PDFEXPORT, GNC_PREF_FILENAME_FMT);
 
         if (format && *format)
diff --git a/gnucash/html/gnc-html.c b/gnucash/html/gnc-html.c
index 0d269f6fa..0c13875ce 100644
--- a/gnucash/html/gnc-html.c
+++ b/gnucash/html/gnc-html.c
@@ -736,7 +736,8 @@ gnc_html_encode_string(const char * str)
     static gchar *safe = "$-._!*(),"; /* RFC 1738 */
     unsigned pos      = 0;
     GString *encoded  = g_string_new ("");
-    gchar buffer[5], *ptr;
+    static const size_t buf_size = 5;
+    gchar buffer[buf_size], *ptr;
     guchar c;
 
     if (!str) return NULL;
@@ -762,7 +763,7 @@ gnc_html_encode_string(const char * str)
         }
         else if ( c != '\r' )
         {
-            sprintf( buffer, "%%%02X", (int)c );
+            snprintf( buffer, buf_size, "%%%02X", (int)c );
             encoded = g_string_append (encoded, buffer);
         }
         pos++;
diff --git a/libgnucash/app-utils/calculation/fin.c b/libgnucash/app-utils/calculation/fin.c
index 3c04118fb..2966a2fb8 100644
--- a/libgnucash/app-utils/calculation/fin.c
+++ b/libgnucash/app-utils/calculation/fin.c
@@ -1214,10 +1214,11 @@
 static double
 rnd (double x, unsigned places)
 {
+    static const size_t buflen = 50; /* make buffer large enough */
     double r;
-    char buf[50];			/* make buffer large enough */
+    char buf[buflen];
 
-    sprintf (buf, "%.*f", (int) places, x);
+    snprintf (buf, buflen, "%.*f", (int) places, x);
     r = strtod(buf, NULL);
 
     return r;
diff --git a/libgnucash/app-utils/gnc-ui-util.c b/libgnucash/app-utils/gnc-ui-util.c
index 534f16d34..43b6c427a 100644
--- a/libgnucash/app-utils/gnc-ui-util.c
+++ b/libgnucash/app-utils/gnc-ui-util.c
@@ -1105,7 +1105,8 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
 {
     struct lconv *lc = gnc_localeconv();
     int num_whole_digits;
-    char temp_buf[128];
+    static const size_t buf_size = 128;
+    char temp_buf[buf_size];
     gnc_numeric whole, rounding;
     int min_dp, max_dp;
     gboolean value_is_negative, value_is_decimal;
@@ -1180,7 +1181,7 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
     // Value may now be decimal, for example if the factional part is zero
     value_is_decimal = gnc_numeric_to_decimal(&val, NULL);
     /* print the integer part without separators */
-    sprintf(temp_buf, "%" G_GINT64_FORMAT, whole.num);
+    snprintf(temp_buf, buf_size, "%" G_GINT64_FORMAT, whole.num);
     num_whole_digits = strlen (temp_buf);
 
     if (!info->use_separators)
@@ -1257,10 +1258,10 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
         val = gnc_numeric_reduce (val);
 
         if (val.denom > 0)
-            sprintf (temp_buf, "%" G_GINT64_FORMAT "/%" G_GINT64_FORMAT,
+            snprintf (temp_buf, buf_size, "%" G_GINT64_FORMAT "/%" G_GINT64_FORMAT,
                      val.num, val.denom);
         else
-            sprintf (temp_buf, "%" G_GINT64_FORMAT " * %" G_GINT64_FORMAT,
+            snprintf (temp_buf, buf_size, "%" G_GINT64_FORMAT " * %" G_GINT64_FORMAT,
                      val.num, -val.denom);
 
         if (whole.num == 0)
diff --git a/libgnucash/backend/xml/test/test-xml2-is-file.cpp b/libgnucash/backend/xml/test/test-xml2-is-file.cpp
index 6303313f0..717bb5e5b 100644
--- a/libgnucash/backend/xml/test/test-xml2-is-file.cpp
+++ b/libgnucash/backend/xml/test/test-xml2-is-file.cpp
@@ -38,9 +38,9 @@ main (int argc, char** argv)
         directory = "test-files/xml2";
     }
 
-    char* filename = static_cast<decltype (filename)> (malloc (strlen (
-            directory) + 1 + strlen (FILENAME) + 1));
-    sprintf (filename, "%s/%s", directory, FILENAME);
+    auto size{strlen (directory) + 1 + strlen (FILENAME) + 1};
+    char* filename = static_cast<decltype (filename)> (malloc (size));
+    snprintf (filename, size, "%s/%s", directory, FILENAME);
     do_test (gnc_is_xml_data_file_v2 (filename, NULL), "gnc_is_xml_data_file_v2");
 
     print_test_results ();
diff --git a/libgnucash/engine/gnc-int128.cpp b/libgnucash/engine/gnc-int128.cpp
index d670232ab..5e3201f1c 100644
--- a/libgnucash/engine/gnc-int128.cpp
+++ b/libgnucash/engine/gnc-int128.cpp
@@ -916,21 +916,21 @@ decimal_from_binary (uint64_t d[dec_array_size], uint64_t hi, uint64_t lo)
 static const uint8_t char_buf_size {41}; //39 digits plus sign and trailing null
 
 char*
-GncInt128::asCharBufR(char* buf) const noexcept
+GncInt128::asCharBufR(char* buf, uint32_t size) const noexcept
 {
     if (isOverflow())
     {
-        sprintf (buf, "%s", "Overflow");
+        snprintf (buf, size, "%s", "Overflow");
         return buf;
     }
     if (isNan())
     {
-        sprintf (buf, "%s", "NaN");
+        snprintf (buf, size, "%s", "NaN");
         return buf;
     }
     if (isZero())
     {
-        sprintf (buf, "%d", 0);
+        snprintf (buf, size, "%d", 0);
         return buf;
     }
     uint64_t d[dec_array_size] {};
@@ -943,10 +943,11 @@ GncInt128::asCharBufR(char* buf) const noexcept
     for (unsigned int i {dec_array_size}; i; --i)
         if (d[i - 1] || trailing)
         {
+            uint32_t new_size = size - (next - buf);
             if (trailing)
-                next += sprintf (next, "%8.8" PRIu64, d[i - 1]);
+                next += snprintf (next, new_size, "%8.8" PRIu64, d[i - 1]);
             else
-                next += sprintf (next, "%" PRIu64, d[i - 1]);
+                next += snprintf (next, new_size, "%" PRIu64, d[i - 1]);
 
             trailing = true;
         }
@@ -958,7 +959,7 @@ std::ostream&
 operator<< (std::ostream& stream, const GncInt128& a) noexcept
 {
     char buf[char_buf_size] {};
-    stream << a.asCharBufR (buf);
+    stream << a.asCharBufR (buf, char_buf_size - 1);
     return stream;
 }
 
diff --git a/libgnucash/engine/gnc-int128.hpp b/libgnucash/engine/gnc-int128.hpp
index a352f73eb..4dc76ab2c 100644
--- a/libgnucash/engine/gnc-int128.hpp
+++ b/libgnucash/engine/gnc-int128.hpp
@@ -215,7 +215,7 @@ enum // Values for m_flags
  * @param buf char[41], 39 digits plus sign and trailing 0.
  * @return pointer to the buffer for convenience
  */
-    char* asCharBufR(char* buf) const noexcept;
+    char* asCharBufR(char* buf, uint32_t size) const noexcept;
 
     GncInt128 abs() const noexcept;
 
diff --git a/libgnucash/engine/gnc-numeric.cpp b/libgnucash/engine/gnc-numeric.cpp
index a33519855..2568fd748 100644
--- a/libgnucash/engine/gnc-numeric.cpp
+++ b/libgnucash/engine/gnc-numeric.cpp
@@ -34,6 +34,7 @@
 #include <boost/locale/encoding_utf.hpp>
 
 #include <config.h>
+#include <stdint.h>
 #include "qof.h"
 
 #include "gnc-numeric.hpp"
@@ -1197,11 +1198,11 @@ gnc_numeric_error(GNCNumericErrorCode error_code)
 gchar *
 gnc_numeric_to_string(gnc_numeric n)
 {
-    gchar *result;
-    gint64 tmpnum = n.num;
-    gint64 tmpdenom = n.denom;
+    char *result;
+    int64_t tmpnum = n.num;
+    int64_t tmpdenom = n.denom;
 
-    result = g_strdup_printf("%" G_GINT64_FORMAT "/%" G_GINT64_FORMAT, tmpnum, tmpdenom);
+    result = g_strdup_printf("%" PRId64 "/%" PRId64, tmpnum, tmpdenom);
 
     return result;
 }
@@ -1211,13 +1212,14 @@ gnc_num_dbg_to_string(gnc_numeric n)
 {
     static char buff[1000];
     static char *p = buff;
-    gint64 tmpnum = n.num;
-    gint64 tmpdenom = n.denom;
+    static const uint64_t size = 50;
+    int64_t tmpnum = n.num;
+    int64_t tmpdenom = n.denom;
 
-    p += 100;
+    p += size;
     if (p - buff >= 1000) p = buff;
 
-    sprintf(p, "%" G_GINT64_FORMAT "/%" G_GINT64_FORMAT, tmpnum, tmpdenom);
+    snprintf(p, size, "%" PRId64 "/%" PRId64, tmpnum, tmpdenom);
 
     return p;
 }
diff --git a/libgnucash/engine/test/gtest-gnc-int128.cpp b/libgnucash/engine/test/gtest-gnc-int128.cpp
index 82ed98ba0..7c215409d 100644
--- a/libgnucash/engine/test/gtest-gnc-int128.cpp
+++ b/libgnucash/engine/test/gtest-gnc-int128.cpp
@@ -318,13 +318,13 @@ TEST(GncInt128_functions, stream_output)
     static const uint8_t char_buf_size {41};
     char buf[char_buf_size] {};
 
-    EXPECT_STREQ("567894392130486207", small.asCharBufR (buf));
-    EXPECT_STREQ("-567894392130486207", neg_small.asCharBufR (buf));
-    EXPECT_STREQ("5237901256262967342410779070006542271", really_big.asCharBufR (buf));
-    EXPECT_STREQ("-5237901256262967342410779070006542271", neg_really_big.asCharBufR (buf));
-    EXPECT_STREQ("36893488147419103231", boundary_value.asCharBufR (buf));
-    EXPECT_STREQ("Overflow", overflowed.asCharBufR (buf));
-    EXPECT_STREQ("NaN", not_a_number.asCharBufR (buf));
+    EXPECT_STREQ("567894392130486207", small.asCharBufR (buf, char_buf_size));
+    EXPECT_STREQ("-567894392130486207", neg_small.asCharBufR (buf, char_buf_size));
+    EXPECT_STREQ("5237901256262967342410779070006542271", really_big.asCharBufR (buf, char_buf_size));
+    EXPECT_STREQ("-5237901256262967342410779070006542271", neg_really_big.asCharBufR (buf, char_buf_size));
+    EXPECT_STREQ("36893488147419103231", boundary_value.asCharBufR (buf, char_buf_size));
+    EXPECT_STREQ("Overflow", overflowed.asCharBufR (buf, char_buf_size));
+    EXPECT_STREQ("NaN", not_a_number.asCharBufR (buf, char_buf_size));
 }
 
 TEST(GncInt128_functions, add_and_subtract)

commit dd2497416c279c68bb8cca720200b874414eab18
Merge: 60c06debc 1cec0cb3f
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jan 23 11:27:05 2023 -0800

    Merge Richard Cohen's 'internal-extern-c' into master.


commit 60c06debce6b647fc73df3d786f9de41c7dfe0b4
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jan 23 11:22:35 2023 -0800

    [c++options] Don't crash when find_option returns nullopt.

diff --git a/libgnucash/engine/gnc-optiondb.cpp b/libgnucash/engine/gnc-optiondb.cpp
index d3e7f9416..7f03a44ad 100644
--- a/libgnucash/engine/gnc-optiondb.cpp
+++ b/libgnucash/engine/gnc-optiondb.cpp
@@ -1311,7 +1311,10 @@ gnc_option_db_lookup_qofinstance_value(GncOptionDB* odb, const char* section,
                                        const char* name)
 {
     auto option{odb->find_option(section, name)};
-    return option->get_value<const QofInstance*>();
+    if (option)
+        return option->get_value<const QofInstance*>();
+    else
+        return nullptr;
 }
 
 // Force creation of templates

commit 1cec0cb3f3100562fce7c878303297971b2e3ed3
Author: Richard Cohen <richard at daijobu.co.uk>
Date:   Mon Jan 23 13:57:38 2023 +0000

    Use internal extern "C" { ... } for C++
    
    - removes warnings compiling swig engine
    ...
    [ 10%] Generating swig-engine.cpp
    .../libgnucash/engine/engine-helpers.h:31: Warning 313: Unrecognized extern type "C++".
    .../libgnucash/engine/gnc-date.h:83: Warning 313: Unrecognized extern type "C++".
    .../libgnucash/engine/qofquery.h:90: Warning 302: Identifier 'QofQuery' redefined (ignored),
    .../libgnucash/engine/gnc-option.hpp:55: Warning 302: previous definition of 'QofQuery'.
    .../libgnucash/engine/gnc-commodity.h:56: Warning 313: Unrecognized extern type "C++".
    .../libgnucash/engine/gncBusiness.h:40: Warning 313: Unrecognized extern type "C++".
    .../libgnucash/engine/gncEntry.h:37: Warning 313: Unrecognized extern type "C++".

diff --git a/bindings/app-utils.i b/bindings/app-utils.i
index fe141ac14..96430c303 100644
--- a/bindings/app-utils.i
+++ b/bindings/app-utils.i
@@ -22,10 +22,6 @@
 %{
 /* Includes the header in the wrapper code */
 #include <glib.h>
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 #include <config.h>
 #include <gnc-euro.h>
 #include <gnc-ui-util.h>
@@ -36,18 +32,14 @@ extern "C"
 #endif
 #include <gnc-accounting-period.h>
 #include <gnc-session.h>
-
-#ifdef __cplusplus
-}
-#endif
 %}
 
 #if defined(SWIGGUILE) //Always C++
 %{
-extern "C"
-{
 #include "guile-mappings.h"
 
+extern "C"
+{
 SCM scm_init_sw_app_utils_module (void);
 }
 %}
diff --git a/bindings/engine.i b/bindings/engine.i
index 2dbd47e0f..186a0860a 100644
--- a/bindings/engine.i
+++ b/bindings/engine.i
@@ -23,11 +23,6 @@
 /* Includes the header in the wrapper code */
 #include <glib.h>
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 #include <config.h>
 #include "qof.h"
 #include "qoflog.h"
@@ -58,9 +53,6 @@ extern "C"
 #include "gncTaxTable.h"
 #include "gncVendor.h"
 
-#ifdef __cplusplus
-}
-#endif
 %}
 #if defined(SWIGGUILE) //Always C++
 %{
diff --git a/bindings/guile/glib-guile.h b/bindings/guile/glib-guile.h
index d22578eaf..d6123d0fd 100644
--- a/bindings/guile/glib-guile.h
+++ b/bindings/guile/glib-guile.h
@@ -28,6 +28,10 @@
 #include <glib.h>
 #include <libguile.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 SCM gnc_glist_to_scm_list(GList *glist, const gchar *wct);
 GList* gnc_scm_list_to_glist(SCM wcp_list);
 
@@ -37,4 +41,8 @@ int     gnc_glist_string_p(SCM list);
 
 GSList * gnc_scm_to_gslist_string(SCM list);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/bindings/guile/gnc-engine-guile.cpp b/bindings/guile/gnc-engine-guile.cpp
index 4470adb20..d9f56f0ee 100644
--- a/bindings/guile/gnc-engine-guile.cpp
+++ b/bindings/guile/gnc-engine-guile.cpp
@@ -27,8 +27,7 @@
 #include "swig-runtime.h"
 #include <libguile.h>
 #include <cstring>
-extern "C"
-{
+
 #include "Account.h"
 #include "engine-helpers.h"
 #include "gnc-engine-guile.h"
@@ -43,7 +42,6 @@ extern "C"
 #ifndef HAVE_STRPTIME
 #    include "strptime.h"
 #endif
-}
 
 /** \todo Code dependent on the private query headers
 qofquery-p.h and qofquerycore-p.h may need to be modified.
diff --git a/bindings/guile/gnc-engine-guile.h b/bindings/guile/gnc-engine-guile.h
index 091939513..2795e8e28 100644
--- a/bindings/guile/gnc-engine-guile.h
+++ b/bindings/guile/gnc-engine-guile.h
@@ -27,15 +27,15 @@
 
 #include <glib.h>
 #include <libguile.h>
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 
 #include "gnc-engine.h"
 #include <gncTaxTable.h>    /* for GncAccountValue */
 #include "gnc-hooks.h"
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
 /* Helpers for various conversions to and from guile */
 
 GDate gnc_time64_to_GDate(SCM x);
diff --git a/bindings/guile/gnc-guile-utils.h b/bindings/guile/gnc-guile-utils.h
index 6a981974e..6649cb13f 100644
--- a/bindings/guile/gnc-guile-utils.h
+++ b/bindings/guile/gnc-guile-utils.h
@@ -27,6 +27,10 @@
 #include <glib.h>
 #include <libguile.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Helper function to get the string representation of
  *  a guile string.
  *
@@ -74,4 +78,8 @@ SCM    gnc_scm_call_1_to_vector(SCM func, SCM arg);
  *  comments. */
 gchar *gnc_scm_strip_comments (SCM scm_text);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/bindings/guile/gnc-helpers.h b/bindings/guile/gnc-helpers.h
index 763037e61..26eea7e2e 100644
--- a/bindings/guile/gnc-helpers.h
+++ b/bindings/guile/gnc-helpers.h
@@ -28,7 +28,15 @@
 
 #include "gnc-ui-util.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 SCM  gnc_printinfo2scm(GNCPrintAmountInfo info);
 GNCPrintAmountInfo gnc_scm2printinfo(SCM info_scm);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/bindings/guile/gnc-kvp-guile.cpp b/bindings/guile/gnc-kvp-guile.cpp
index 33c04cf33..d1e011c18 100644
--- a/bindings/guile/gnc-kvp-guile.cpp
+++ b/bindings/guile/gnc-kvp-guile.cpp
@@ -3,8 +3,6 @@
 #include <libguile.h>
 #include <numeric>
 
-extern "C"
-{
 #include <config.h>
 
 #include <qof.h>
@@ -13,7 +11,6 @@ extern "C"
 #include "gnc-engine-guile.h"
 #include "gnc-guile-utils.h"
 #include "gnc-kvp-guile.h"
-}
 
 /* NOTE: There are some problems with this approach. Currently,
  *       guids are stored simply as strings in scheme, so some
diff --git a/bindings/guile/gnc-kvp-guile.h b/bindings/guile/gnc-kvp-guile.h
index 46ee642a7..287410f20 100644
--- a/bindings/guile/gnc-kvp-guile.h
+++ b/bindings/guile/gnc-kvp-guile.h
@@ -21,12 +21,13 @@
 #ifndef KVP_SCM_H
 #define KVP_SCM_H
 
+#include <qof.h>
+#include <libguile.h>
+
 #ifdef __cplusplus
 extern "C"
 {
 #endif
-#include <qof.h>
-#include <libguile.h>
 
 KvpValue* gnc_scm_to_kvp_value_ptr(SCM kvpval);
 SCM gnc_kvp_value_ptr_to_scm(KvpValue* val);
diff --git a/bindings/guile/test/test-print-queries.cpp b/bindings/guile/test/test-print-queries.cpp
index 20e326a95..3442a6dd1 100644
--- a/bindings/guile/test/test-print-queries.cpp
+++ b/bindings/guile/test/test-print-queries.cpp
@@ -23,15 +23,11 @@
 #include <libguile.h>
 #include "guile-mappings.h"
 
-extern "C"
-{
-
 #include "gnc-engine-guile.h"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
 #include "Query.h"
 #include "TransLog.h"
-}
 
 static void
 test_query (Query *q, SCM val2str)
diff --git a/bindings/guile/test/test-scm-query-string.cpp b/bindings/guile/test/test-scm-query-string.cpp
index 5e3b60b8f..bfc5810a8 100644
--- a/bindings/guile/test/test-scm-query-string.cpp
+++ b/bindings/guile/test/test-scm-query-string.cpp
@@ -23,15 +23,12 @@
 #include "guile-mappings.h"
 #include <libguile.h>
 
-extern "C"
-{
 #include "gnc-engine-guile.h"
 #include "gnc-guile-utils.h"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
 #include "Query.h"
 #include "TransLog.h"
-}
 
 static void
 test_query (Query *q, SCM val2str)
diff --git a/bindings/guile/test/test-scm-query.cpp b/bindings/guile/test/test-scm-query.cpp
index b8ae768e7..cd7b0a0cb 100644
--- a/bindings/guile/test/test-scm-query.cpp
+++ b/bindings/guile/test/test-scm-query.cpp
@@ -22,15 +22,12 @@
 #include <libguile.h>
 #include <glib.h>
 
-extern "C"
-{
 
 #include "gnc-engine-guile.h"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
 #include "Query.h"
 #include "TransLog.h"
-}
 
 static void
 test_query (QofQuery *q)
diff --git a/common/test-core/unittest-support.h b/common/test-core/unittest-support.h
index 64eff447d..0b9b8a156 100644
--- a/common/test-core/unittest-support.h
+++ b/common/test-core/unittest-support.h
@@ -25,6 +25,11 @@
 
 #include <glib.h>
 #include <qof.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @file unittest-support.h
  * @brief Macros and logging-capture functions to ease writing GLib-testing
  *  based unit tests.
@@ -356,4 +361,8 @@ void gnc_log_shutdown (void);
 void gnc_log_set_handler (guint logdomain, gchar *logdomain, GLogFunc * func, gpointer data);
 */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /*UNITTEST_SUPPORT_H*/
diff --git a/gnucash/gnome-search/gnc-general-search.h b/gnucash/gnome-search/gnc-general-search.h
index dc514639d..1c02ed3a3 100644
--- a/gnucash/gnome-search/gnc-general-search.h
+++ b/gnucash/gnome-search/gnc-general-search.h
@@ -34,6 +34,10 @@
 
 #include "dialog-search.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_TYPE_GENERAL_SEARCH \
 	(gnc_general_search_get_type ())
 
@@ -91,4 +95,8 @@ GType      gnc_general_search_get_type       (void);
 void	   gnc_general_search_grab_focus (GNCGeneralSearch *gsl);
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-search/search-core-type.h b/gnucash/gnome-search/search-core-type.h
index 4abd8565d..e9a81deeb 100644
--- a/gnucash/gnome-search/search-core-type.h
+++ b/gnucash/gnome-search/search-core-type.h
@@ -25,6 +25,10 @@
 #include "qof.h"
 #include "search-param.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_TYPE_SEARCH_CORE_TYPE		(gnc_search_core_type_get_type ())
 #define GNC_SEARCH_CORE_TYPE(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreType))
 #define GNC_SEARCH_CORE_TYPE_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreTypeClass))
@@ -81,5 +85,8 @@ void gnc_search_core_register_type (const char *type_name,
 void gnc_search_core_initialize (void);
 void gnc_search_core_finalize (void);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* ! _GNCSEARCH_CORE_TYPE_H */
diff --git a/gnucash/gnome-utils/dialog-doclink-utils.h b/gnucash/gnome-utils/dialog-doclink-utils.h
index 0d2b6a36d..7436d85fe 100644
--- a/gnucash/gnome-utils/dialog-doclink-utils.h
+++ b/gnucash/gnome-utils/dialog-doclink-utils.h
@@ -23,6 +23,10 @@
 #ifndef DIALOG_DOCLINK_UTILS_H
 #define DIALOG_DOCLINK_UTILS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_DOC_LINK_PATH_HEAD "assoc-head"
 /* Note, assoc-head is the old name for the document link head which has been
    kept for compatibility */
@@ -120,4 +124,8 @@ gchar * gnc_doclink_get_unescaped_just_uri (const gchar *uri);
  */
 void gnc_doclink_pref_path_head_changed (GtkWindow *parent, const gchar *old_path_head_uri);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-utils/dialog-file-access.h b/gnucash/gnome-utils/dialog-file-access.h
index bf8cb38b0..8bed1a10b 100644
--- a/gnucash/gnome-utils/dialog-file-access.h
+++ b/gnucash/gnome-utils/dialog-file-access.h
@@ -34,10 +34,18 @@
  *  loading/open and for saving.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void gnc_ui_file_access_for_open (GtkWindow *parent);
 void gnc_ui_file_access_for_save_as (GtkWindow *parent);
 void gnc_ui_file_access_for_export (GtkWindow *parent);
 
+#ifdef __cplusplus
+}
+#endif
+
 /** @} */
 
 #endif /* DIALOG_FILE_ACCESS_H */
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 19f901b27..b0a085c46 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -23,10 +23,7 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 \********************************************************************/
 
-extern "C"
-{
 #include <config.h> // Need this to include Account.h
-}
 
 #include <Account.h> // To include as C++ overriding later indirect includes
 #include <gtk/gtk.h>
@@ -37,8 +34,6 @@ extern "C"
 #include "dialog-options.hpp"
 #include <libguile.h>
 
-extern "C"
-{
 #include <qofbookslots.h> // for OPTION_SECTION_ACCOUNTS
 
 #include "dialog-utils.h"
@@ -46,7 +41,6 @@ extern "C"
 #include <gnc-prefs.h> // for GNC_PREFS_NUM_SOURCE
 #include "gnc-session.h" // for gnc_get_current_session
 #include "gnc-ui.h" // for DF_MANUAL
-}
 
 #include <iostream>
 #include <sstream>
diff --git a/gnucash/gnome-utils/dialog-preferences.h b/gnucash/gnome-utils/dialog-preferences.h
index f3154eac7..22fec3260 100644
--- a/gnucash/gnome-utils/dialog-preferences.h
+++ b/gnucash/gnome-utils/dialog-preferences.h
@@ -62,6 +62,10 @@
 
 #include <gtk/gtk.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** This function adds a full page of preferences to the preferences
  *  dialog.  When the dialog is created, the specified widget will be
  *  pulled from the specified glade file and added to the preferences
@@ -104,6 +108,10 @@ void gnc_preferences_add_to_page (const gchar *filename,
  *  the window stack instead of creating a new dialog. */
 void gnc_preferences_dialog (GtkWindow *parent);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 /** @} */
 /** @} */
diff --git a/gnucash/gnome-utils/dialog-reset-warnings.h b/gnucash/gnome-utils/dialog-reset-warnings.h
index 51692b479..f61137e36 100644
--- a/gnucash/gnome-utils/dialog-reset-warnings.h
+++ b/gnucash/gnome-utils/dialog-reset-warnings.h
@@ -22,4 +22,13 @@
  *                                                                     *
  **********************************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void gnc_reset_warnings_dialog (GtkWindow *parent);
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/gnucash/gnome-utils/dialog-transfer.cpp b/gnucash/gnome-utils/dialog-transfer.cpp
index 803c7ae9d..f1d3acf04 100644
--- a/gnucash/gnome-utils/dialog-transfer.cpp
+++ b/gnucash/gnome-utils/dialog-transfer.cpp
@@ -29,7 +29,6 @@
 #include <glib/gi18n.h>
 #include <gnc-quotes.hpp>
 
-extern "C" {
 #include "dialog-transfer.h"
 #include "dialog-utils.h"
 #include "gnc-amount-edit.h"
@@ -48,7 +47,6 @@ extern "C" {
 #include "engine-helpers.h"
 #include "QuickFill.h"
 #include <gnc-commodity.h>
-}
 
 
 #define DIALOG_TRANSFER_CM_CLASS "dialog-transfer"
diff --git a/gnucash/gnome-utils/dialog-transfer.h b/gnucash/gnome-utils/dialog-transfer.h
index 9d4870a84..fc65394bc 100644
--- a/gnucash/gnome-utils/dialog-transfer.h
+++ b/gnucash/gnome-utils/dialog-transfer.h
@@ -26,6 +26,10 @@
 
 #include "Account.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct _xferDialog XferDialog;
 
 /** Opens up a window to do an automatic transfer between accounts
@@ -221,4 +225,8 @@ gboolean gnc_xfer_dialog_run_exchange_dialog(
     Account *reg_acc, Transaction *txn, gnc_commodity *xfer_com,
     gboolean expanded);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-utils/dialog-utils.h b/gnucash/gnome-utils/dialog-utils.h
index 7278ab244..e89aee3a7 100644
--- a/gnucash/gnome-utils/dialog-utils.h
+++ b/gnucash/gnome-utils/dialog-utils.h
@@ -29,6 +29,10 @@
 #include <gtk/gtk.h>
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_PREF_GRID_LINES_HORIZONTAL "grid-lines-horizontal"
 #define GNC_PREF_GRID_LINES_VERTICAL   "grid-lines-vertical"
 
@@ -165,4 +169,8 @@ gnc_cost_policy_select_new (void);
  */
 gchar* gnc_get_negative_color (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* DIALOG_UTILS_H */
diff --git a/gnucash/gnome-utils/gnc-account-sel.h b/gnucash/gnome-utils/gnc-account-sel.h
index 7ec5f116f..297f58f6f 100644
--- a/gnucash/gnome-utils/gnc-account-sel.h
+++ b/gnucash/gnome-utils/gnc-account-sel.h
@@ -33,6 +33,10 @@
 
 #include "Account.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_TYPE_ACCOUNT_SEL          (gnc_account_sel_get_type())
 #define GNC_ACCOUNT_SEL(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_ACCOUNT_SEL, GNCAccountSel)
 #define GNC_ACCOUNT_SEL_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_ACCOUNT_SEL, GNCAccountSelClass)
@@ -108,4 +112,8 @@ gint gnc_account_sel_get_num_account (GNCAccountSel *gas);
 void gnc_account_sel_purge_account (GNCAccountSel *gas, Account *acc, gboolean recursive);
 void gnc_account_sel_set_hexpand (GNCAccountSel *gas, gboolean expand);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_ACCOUNT_SEL_H */
diff --git a/gnucash/gnome-utils/gnc-amount-edit.h b/gnucash/gnome-utils/gnc-amount-edit.h
index 158d2c6cd..a26c6e578 100644
--- a/gnucash/gnome-utils/gnc-amount-edit.h
+++ b/gnucash/gnome-utils/gnc-amount-edit.h
@@ -32,6 +32,10 @@
 
 #include <gtk/gtk.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_TYPE_AMOUNT_EDIT          (gnc_amount_edit_get_type ())
 #define GNC_AMOUNT_EDIT(obj)          G_TYPE_CHECK_INSTANCE_CAST(obj, GNC_TYPE_AMOUNT_EDIT, GNCAmountEdit)
 #define GNC_AMOUNT_EDIT_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST(klass, GNC_TYPE_AMOUNT_EDIT, GNCAmountEditClass)
@@ -245,4 +249,8 @@ void gnc_amount_edit_show_warning_symbol (GNCAmountEdit *gae, gboolean show);
  */
 void gnc_amount_edit_make_mnemonic_target (GNCAmountEdit *gae, GtkWidget *label);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-utils/gnc-autoclear.h b/gnucash/gnome-utils/gnc-autoclear.h
index 1896c2c05..ac9807d12 100644
--- a/gnucash/gnome-utils/gnc-autoclear.h
+++ b/gnucash/gnome-utils/gnc-autoclear.h
@@ -27,6 +27,10 @@
 #include <glib.h>
 #include <Account.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Account splits are analysed; attempts to find a unique combination
  *  of uncleared splits which would set cleared balance to
  *  toclear_value. If this is not possible, *errmsg will be error
@@ -36,4 +40,8 @@
 GList * gnc_account_get_autoclear_splits (Account *account, gnc_numeric toclear_value,
                                           gchar **errmsg);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-utils/gnc-autosave.h b/gnucash/gnome-utils/gnc-autosave.h
index c49f5e64d..101b6e84a 100644
--- a/gnucash/gnome-utils/gnc-autosave.h
+++ b/gnucash/gnome-utils/gnc-autosave.h
@@ -27,6 +27,10 @@
 #include <gtk/gtk.h>
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Callback that is used to notify the autosave subsystem when the
     QofBook changed its dirty state. */
 void gnc_autosave_dirty_handler (QofBook *book, gboolean dirty);
@@ -34,4 +38,8 @@ void gnc_autosave_dirty_handler (QofBook *book, gboolean dirty);
 /** Removes any still existing autosave timer from the event loop. */
 void gnc_autosave_remove_timer(QofBook *book);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-utils/gnc-commodity-edit.h b/gnucash/gnome-utils/gnc-commodity-edit.h
index c4b21486e..1c021b7d5 100644
--- a/gnucash/gnome-utils/gnc-commodity-edit.h
+++ b/gnucash/gnome-utils/gnc-commodity-edit.h
@@ -34,6 +34,10 @@
 
 #include "gnc-commodity.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Callback function to return the printable string of a commodity */
 const char * gnc_commodity_edit_get_string (gpointer ptr);
 
@@ -45,4 +49,8 @@ const char * gnc_commodity_edit_get_string (gpointer ptr);
 gpointer gnc_commodity_edit_new_select (gpointer arg, gpointer ptr,
                                         GtkWidget *toplevel);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-utils/gnc-component-manager.h b/gnucash/gnome-utils/gnc-component-manager.h
index 742faefa7..be25a7eee 100644
--- a/gnucash/gnome-utils/gnc-component-manager.h
+++ b/gnucash/gnome-utils/gnc-component-manager.h
@@ -24,6 +24,10 @@
 
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 #define NO_COMPONENT (-1)
 
@@ -333,4 +337,8 @@ gint gnc_forall_gui_components (const char *component_class,
                                 GNCComponentHandler handler,
                                 gpointer iter_data);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-utils/gnc-currency-edit.h b/gnucash/gnome-utils/gnc-currency-edit.h
index 652050e81..2293081a6 100644
--- a/gnucash/gnome-utils/gnc-currency-edit.h
+++ b/gnucash/gnome-utils/gnc-currency-edit.h
@@ -57,6 +57,10 @@
 
 #include "gnc-commodity.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @name Basic Object Implementation */
 /** @{ */
 
@@ -126,6 +130,10 @@ void gnc_currency_edit_clear_display (GNCCurrencyEdit *gce);
 
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/gnucash/gnome-utils/gnc-date-edit.h b/gnucash/gnome-utils/gnc-date-edit.h
index 68f5478f8..3ee92031f 100644
--- a/gnucash/gnome-utils/gnc-date-edit.h
+++ b/gnucash/gnome-utils/gnc-date-edit.h
@@ -35,6 +35,10 @@
 #include <time.h>
 #include "gnc-date.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum
 {
     GNC_DATE_EDIT_SHOW_TIME             = 1 << 0,
@@ -135,4 +139,9 @@ void      gnc_date_activates_default    (GNCDateEdit *gde, gboolean state);
 void      gnc_date_grab_focus           (GNCDateEdit *gde);
 
 void      gnc_date_make_mnemonic_target (GNCDateEdit *gde, GtkWidget *label);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-utils/gnc-date-format.h b/gnucash/gnome-utils/gnc-date-format.h
index 41abcc05e..a0d02dbb4 100644
--- a/gnucash/gnome-utils/gnc-date-format.h
+++ b/gnucash/gnome-utils/gnc-date-format.h
@@ -31,6 +31,10 @@
 
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_TYPE_DATE_FORMAT          (gnc_date_format_get_type ())
 #define GNC_DATE_FORMAT(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, gnc_date_format_get_type(), GNCDateFormat)
 #define GNC_DATE_FORMAT_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gnc_date_format_get_type(), GNCDateFormatClass)
@@ -71,4 +75,8 @@ const char* gnc_date_format_get_custom    (GNCDateFormat *gdf);
 
 void      gnc_date_format_refresh         (GNCDateFormat *gdf);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome-utils/gnc-file.h b/gnucash/gnome-utils/gnc-file.h
index 7c723ebdf..3fbaca039 100644
--- a/gnucash/gnome-utils/gnc-file.h
+++ b/gnucash/gnome-utils/gnc-file.h
@@ -119,6 +119,10 @@
 #include "qof.h"
 #include <gtk/gtk.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum
 {
     GNC_FILE_DIALOG_OPEN,
@@ -168,4 +172,8 @@ typedef void (*GNCShutdownCB) (int);
 void gnc_file_set_shutdown_callback (GNCShutdownCB cb);
 gboolean gnc_file_save_in_progress (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_FILE_H */
diff --git a/gnucash/gnome-utils/gnc-frequency.h b/gnucash/gnome-utils/gnc-frequency.h
index 561824da8..8aba8fe91 100644
--- a/gnucash/gnome-utils/gnc-frequency.h
+++ b/gnucash/gnome-utils/gnc-frequency.h
@@ -29,6 +29,10 @@
 #include "FreqSpec.h"
 #include "Recurrence.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_TYPE_FREQUENCY	  (gnc_frequency_get_type())
 #define GNC_FREQUENCY(obj)	  G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_FREQUENCY, GncFrequency)
 #define GNC_FREQENCY_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_FREQUENCY, GncFrequency)
@@ -101,4 +105,8 @@ void gnc_frequency_set_frequency_label_text (GncFrequency *gf, const gchar *txt)
  */
 void gnc_frequency_set_date_label_text (GncFrequency *gf, const gchar *txt);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* !defined( GNC_FREQUENCY_H ) */
diff --git a/gnucash/gnome-utils/gnc-general-select.h b/gnucash/gnome-utils/gnc-general-select.h
index d46e72d2c..12f08caae 100644
--- a/gnucash/gnome-utils/gnc-general-select.h
+++ b/gnucash/gnome-utils/gnc-general-select.h
@@ -31,6 +31,10 @@
 #ifndef GNC_GENERAL_SELECT_H
 #define GNC_GENERAL_SELECT_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_TYPE_GENERAL_SELECT          (gnc_general_select_get_type ())
 #define GNC_GENERAL_SELECT(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, gnc_general_select_get_type(), GNCGeneralSelect)
 #define GNC_GENERAL_SELECT_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gnc_general_select_get_type(), \ GNCGeneralSelectClass)
@@ -83,5 +87,9 @@ GType      gnc_general_select_get_type       (void);
 
 void       gnc_general_select_make_mnemonic_target (GNCGeneralSelect *gsl, GtkWidget *label);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
diff --git a/gnucash/gnome-utils/gnc-gnome-utils.h b/gnucash/gnome-utils/gnc-gnome-utils.h
index 471d67189..05cba2ec0 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.h
+++ b/gnucash/gnome-utils/gnc-gnome-utils.h
@@ -37,6 +37,10 @@
 
 #include <gnc-main-window.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Initialize the gnome-utils library
  *  Should be run once before using any gnome-utils features.
  */
@@ -101,6 +105,10 @@ GncMainWindow *gnc_gui_init (void);
 int gnc_ui_start_event_loop (void);
 gboolean gnucash_ui_is_running (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 /** @} */
 /** @} */
diff --git a/gnucash/gnome-utils/gnc-gobject-utils.h b/gnucash/gnome-utils/gnc-gobject-utils.h
index c0fd9cff9..3d066e45c 100644
--- a/gnucash/gnome-utils/gnc-gobject-utils.h
+++ b/gnucash/gnome-utils/gnc-gobject-utils.h
@@ -41,6 +41,10 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @name Gobject Tracking Functions
  *  @{
  *
@@ -165,6 +169,10 @@ type_name##_get_type (void) \
   return g_define_type_id_static;    \
 } /* closes type_name##_get_type() */
 
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif /* GNC_GOBJECT_UTILS_H */
 /** @} */
diff --git a/gnucash/gnome-utils/gnc-gtk-utils.h b/gnucash/gnome-utils/gnc-gtk-utils.h
index 43e2c0375..bc77574fd 100644
--- a/gnucash/gnome-utils/gnc-gtk-utils.h
+++ b/gnucash/gnome-utils/gnc-gtk-utils.h
@@ -37,6 +37,10 @@
 
 #include <gtk/gtk.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @name gtk Miscellaneous Functions
  @{
 */
@@ -96,5 +100,9 @@ void gnc_menubar_model_remove_items_with_attrib (GMenuModel *menu_model, const g
 
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_GTK_UTILS_H */
 /** @} */
diff --git a/gnucash/gnome-utils/gnc-gui-query.h b/gnucash/gnome-utils/gnc-gui-query.h
index e6b7fac5e..6e34e6479 100644
--- a/gnucash/gnome-utils/gnc-gui-query.h
+++ b/gnucash/gnome-utils/gnc-gui-query.h
@@ -23,6 +23,10 @@
 #ifndef QUERY_USER_H
 #define QUERY_USER_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern void
 gnc_info_dialog (GtkWindow *parent,
                  const char *format, ...) G_GNUC_PRINTF (2, 3);
@@ -30,5 +34,9 @@ gnc_info_dialog (GtkWindow *parent,
 
 void gnc_error_dialog (GtkWindow* parent, const char* format, ...) G_GNUC_PRINTF (2, 3);
 
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif
diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp
index d4dd2b568..4a857ef24 100644
--- a/gnucash/gnome-utils/gnc-main-window.cpp
+++ b/gnucash/gnome-utils/gnc-main-window.cpp
@@ -39,8 +39,6 @@
 #include "dialog-options.hpp"
 #include <libguile.h>
 
-extern "C"
-{
 #include <config.h>
 
 
@@ -88,7 +86,6 @@ extern "C"
 # include <sys/types.h>
 # include <sys/stat.h> // for stat(2)
 #endif
-}
 
 /** Names of signals generated by the main window. */
 enum
diff --git a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
index 38fb4d60d..763a372f0 100644
--- a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
+++ b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
@@ -23,8 +23,6 @@
 #include <gnc-option.hpp>
 #include <gnc-option-impl.hpp>
 #include "gnc-option-gtk-ui.hpp"
-extern "C"
-{
 #include <config.h>  // for scanf format string
 #include <qof.h>
 #include <gnc-engine.h> // for GNC_MOD_GUI
@@ -38,7 +36,6 @@ extern "C"
 #include "gnc-tree-view-account.h" // for GNC_TREE_VIEW_ACCOUNT
 #include "gnc-tree-model-budget.h" // for gnc_tree_model_budget
 #include "misc-gnome-utils.h" // for xxxgtk_textview_set_text
-}
 
 /*Something somewhere in windows.h defines ABSOLUTE to something and
  *that contaminates using it in RelativeDateType.  Undef it.
diff --git a/gnucash/gnome-utils/gnc-splash.h b/gnucash/gnome-utils/gnc-splash.h
index c6819f45b..acc204b89 100644
--- a/gnucash/gnome-utils/gnc-splash.h
+++ b/gnucash/gnome-utils/gnc-splash.h
@@ -24,11 +24,19 @@
 #define GNC_SPLASH_H
 #include <gtk/gtk.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void gnc_show_splash_screen (void);
 void gnc_destroy_splash_screen (void);
 void gnc_update_splash_screen (const gchar *string, double percentage);
 GtkWindow *gnc_get_splash_screen (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #define GNC_SPLASH_PERCENTAGE_UNKNOWN 101
 
 #endif
diff --git a/gnucash/gnome-utils/gnc-tree-model-budget.h b/gnucash/gnome-utils/gnc-tree-model-budget.h
index 03fbdf905..bedd273af 100644
--- a/gnucash/gnome-utils/gnc-tree-model-budget.h
+++ b/gnucash/gnome-utils/gnc-tree-model-budget.h
@@ -34,6 +34,10 @@
 
 #include "gnc-budget.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* The budget list columns. */
 enum
 {
@@ -54,4 +58,8 @@ gboolean gnc_tree_model_budget_get_iter_for_budget(GtkTreeModel *tm,
         GtkTreeIter *iter,
         GncBudget *bgt);
 /** @} */
+#ifdef __cplusplus
+}
+#endif
+
 #endif // __GNC_TREE_MODEL_BUDGET_H__
diff --git a/gnucash/gnome-utils/gnc-ui.h b/gnucash/gnome-utils/gnc-ui.h
index 1473f5944..5715321b2 100644
--- a/gnucash/gnome-utils/gnc-ui.h
+++ b/gnucash/gnome-utils/gnc-ui.h
@@ -37,6 +37,10 @@
 #include "gnc-pricedb.h"
 #include <gtk/gtk.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 /** Documentation references ****************************************/
 #ifdef G_OS_WIN32
@@ -191,5 +195,9 @@ GtkWindow *gnc_ui_get_main_window (GtkWidget *widget);
 void gnc_set_busy_cursor(GtkWidget *w, gboolean update_now);
 void gnc_unset_busy_cursor(GtkWidget *w);
 
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif
diff --git a/gnucash/gnome-utils/misc-gnome-utils.h b/gnucash/gnome-utils/misc-gnome-utils.h
index 3b78968c5..34b75ace7 100644
--- a/gnucash/gnome-utils/misc-gnome-utils.h
+++ b/gnucash/gnome-utils/misc-gnome-utils.h
@@ -20,8 +20,16 @@
 #ifndef __GTT_UTIL_H__
 #define __GTT_UTIL_H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Some gtk-like utilities */
 void xxxgtk_textview_set_text (GtkTextView *text, const char *str);
 char * xxxgtk_textview_get_text (GtkTextView *text);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __GTT_UTIL_H__ */
diff --git a/gnucash/gnome-utils/print-session.h b/gnucash/gnome-utils/print-session.h
index 45540ee40..277d813a2 100644
--- a/gnucash/gnome-utils/print-session.h
+++ b/gnucash/gnome-utils/print-session.h
@@ -36,6 +36,10 @@
 
 #include <gtk/gtk.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Retrieve the print settings from the GtkPrintOperation @a op and save them in
  * a static variable.
@@ -69,6 +73,10 @@ GtkPrintSettings *gnc_print_get_settings(void);
 /** Key for saving the PDF-export directory in the print settings */
 #define GNC_GTK_PRINT_SETTINGS_EXPORT_DIR "gnc-pdf-export-directory"
 
+#ifdef __cplusplus
+}
+#endif
+
 
 /** @} */
 /** @} */
diff --git a/gnucash/gnome-utils/test/test-autoclear.cpp b/gnucash/gnome-utils/test/test-autoclear.cpp
index fd9799148..288074e90 100644
--- a/gnucash/gnome-utils/test/test-autoclear.cpp
+++ b/gnucash/gnome-utils/test/test-autoclear.cpp
@@ -24,9 +24,7 @@
 #include "config.h"
 #include <glib.h>
 // GoogleTest is written in C++, however, the function we test in C.
-extern "C" {
 #include "../gnc-autoclear.h"
-}
 #include <memory>
 #include <Account.h>
 #include <Split.h>
diff --git a/gnucash/gnome/assistant-hierarchy.cpp b/gnucash/gnome/assistant-hierarchy.cpp
index 7e64b2526..4f769e2bc 100644
--- a/gnucash/gnome/assistant-hierarchy.cpp
+++ b/gnucash/gnome/assistant-hierarchy.cpp
@@ -29,8 +29,6 @@
 #include <gnc-optiondb.h>
 #include <libguile.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <platform.h>
@@ -68,7 +66,6 @@ extern "C"
 #include "gnc-plugin-page-account-tree.h"
 
 #include "gnc-engine.h"
-}
 
 static QofLogModule log_module = GNC_MOD_IMPORT;
 
diff --git a/gnucash/gnome/assistant-loan.cpp b/gnucash/gnome/assistant-loan.cpp
index a55393215..817bc6f5f 100644
--- a/gnucash/gnome/assistant-loan.cpp
+++ b/gnucash/gnome/assistant-loan.cpp
@@ -27,8 +27,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include <stdlib.h>
@@ -52,7 +50,6 @@ extern "C"
 #ifdef __MINGW32__
 #include <Windows.h>
 #endif
-}
 
 #include <gnc-locale-utils.hpp>
 #include <boost/locale.hpp>
diff --git a/gnucash/gnome/assistant-loan.h b/gnucash/gnome/assistant-loan.h
index 3e5062e8a..7c73fd8e7 100644
--- a/gnucash/gnome/assistant-loan.h
+++ b/gnucash/gnome/assistant-loan.h
@@ -22,4 +22,13 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 \********************************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void gnc_ui_sx_loan_assistant_create(void);
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/gnucash/gnome/assistant-stock-transaction.cpp b/gnucash/gnome/assistant-stock-transaction.cpp
index 077ef428a..248240cbd 100644
--- a/gnucash/gnome/assistant-stock-transaction.cpp
+++ b/gnucash/gnome/assistant-stock-transaction.cpp
@@ -31,7 +31,6 @@
 #include <optional>
 #include <stdexcept>
 
-extern "C" {
 #include "Transaction.h"
 #include "engine-helpers.h"
 #include "dialog-utils.h"
@@ -49,7 +48,6 @@ void stock_assistant_prepare (GtkAssistant  *assistant, GtkWidget *page,
                               gpointer user_data);
 void stock_assistant_finish  (GtkAssistant *assistant, gpointer user_data);
 void stock_assistant_cancel  (GtkAssistant *gtkassistant, gpointer user_data);
-}
 
 enum class FieldMask : unsigned;
 bool operator &(FieldMask lhs, FieldMask rhs);
diff --git a/gnucash/gnome/assistant-stock-transaction.h b/gnucash/gnome/assistant-stock-transaction.h
index 3173976a4..2e7645df5 100644
--- a/gnucash/gnome/assistant-stock-transaction.h
+++ b/gnucash/gnome/assistant-stock-transaction.h
@@ -25,6 +25,10 @@
 
 #include "Account.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /********************************************************************\
  * gnc_stock_transaction_assistant                                  *
  *   opens up a assistant to record a stock transaction             *
@@ -35,4 +39,8 @@
 \********************************************************************/
 void gnc_stock_transaction_assistant (GtkWidget *parent, Account * account);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome/business-gnome-utils.h b/gnucash/gnome/business-gnome-utils.h
index 24dcf3f58..de298743c 100644
--- a/gnucash/gnome/business-gnome-utils.h
+++ b/gnucash/gnome/business-gnome-utils.h
@@ -30,6 +30,10 @@
 #include "gncTaxTable.h"
 #include "gncInvoice.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 #define GNC_PREFS_GROUP_INVOICE "dialogs.business.invoice"
 #define GNC_PREFS_GROUP_BILL    "dialogs.business.bill"
@@ -106,4 +110,8 @@ gpointer gnc_simple_combo_get_value (GtkComboBox *cbox);
 void gnc_simple_combo_set_value (GtkComboBox *cbox, gpointer data);
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_BUSINESS_GNOME_UTILS_H_ */
diff --git a/gnucash/gnome/business-options-gnome.cpp b/gnucash/gnome/business-options-gnome.cpp
index 8249314e9..eb1041e58 100644
--- a/gnucash/gnome/business-options-gnome.cpp
+++ b/gnucash/gnome/business-options-gnome.cpp
@@ -26,15 +26,12 @@
 #include <glib/gi18n.h>
 #include "business-options-gnome.h"
 
-extern "C"
-{
 #include <config.h> // for scanf format string
 #include <qof.h>
 #include <business-gnome-utils.h>
 #include <gnc-ui-util.h> // for gnc_get_current_book
 #include <gnc-general-search.h> // for GNC_GENERAL_SEARCH
 #include "dialog-utils.h" // for gnc_builder_add_from_file
-}
 
 
 #include <iostream>
diff --git a/gnucash/gnome/dialog-custom-report.h b/gnucash/gnome/dialog-custom-report.h
index 1f35f273d..9b21e5ce7 100644
--- a/gnucash/gnome/dialog-custom-report.h
+++ b/gnucash/gnome/dialog-custom-report.h
@@ -30,6 +30,10 @@
 
 #include "gnc-main-window.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @addtogroup Reports
     @{ */
 /** @file dialog-custom-report.h
@@ -45,6 +49,10 @@ gnc_ui_custom_report_edit_name(GncMainWindow * window, SCM scm_guid);
 
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* DIALOG_CUSTOM_REPORT_H */
 
 
diff --git a/gnucash/gnome/dialog-new-user.h b/gnucash/gnome/dialog-new-user.h
index 78e9a0fc8..b92ade6b8 100644
--- a/gnucash/gnome/dialog-new-user.h
+++ b/gnucash/gnome/dialog-new-user.h
@@ -23,6 +23,10 @@
 #ifndef DIALOG_NEW_USER_H
 #define DIALOG_NEW_USER_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_PREFS_GROUP_NEW_USER "dialogs.new-user"
 #define GNC_PREF_FIRST_STARTUP "first-startup"
 
@@ -39,4 +43,8 @@ void gnc_new_user_dialog_register_qif_assistant (void (*cb_fcn)(void));
 /* private */
 void gncp_new_user_finish (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome/dialog-price-edit-db.cpp b/gnucash/gnome/dialog-price-edit-db.cpp
index beee0995e..ff66d2c87 100644
--- a/gnucash/gnome/dialog-price-edit-db.cpp
+++ b/gnucash/gnome/dialog-price-edit-db.cpp
@@ -30,7 +30,6 @@
 #include <time.h>
 #include <gnc-quotes.hpp>
 
-extern "C" {
 #include "dialog-utils.h"
 #include "gnc-accounting-period.h"
 #include "gnc-amount-edit.h"
@@ -48,7 +47,6 @@ extern "C" {
 #include "gnc-ui-util.h"
 #include "gnc-warnings.h"
 #include <gnc-glib-utils.h>
-}
 
 
 #define DIALOG_PRICE_DB_CM_CLASS "dialog-price-edit-db"
diff --git a/gnucash/gnome/dialog-report-column-view.cpp b/gnucash/gnome/dialog-report-column-view.cpp
index 838e8a272..f23854d8c 100644
--- a/gnucash/gnome/dialog-report-column-view.cpp
+++ b/gnucash/gnome/dialog-report-column-view.cpp
@@ -28,8 +28,6 @@
 #include <gnc-optiondb-impl.hpp>
 #include <libguile.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include "swig-runtime.h"
@@ -39,7 +37,6 @@ extern "C"
 #include "guile-mappings.h"
 #include "gnc-guile-utils.h"
 #include "gnc-ui.h"
-}
 
 #include "dialog-report-column-view.hpp"
 #include <gnc-report.h>
diff --git a/gnucash/gnome/dialog-report-column-view.hpp b/gnucash/gnome/dialog-report-column-view.hpp
index 9d3843b83..6670349b6 100644
--- a/gnucash/gnome/dialog-report-column-view.hpp
+++ b/gnucash/gnome/dialog-report-column-view.hpp
@@ -24,10 +24,10 @@
 #define GNC_DIALOG_COLUMN_VIEW_H
 
 #include <libguile.h>
-extern "C"
-{
 #include <gtk/gtk.h>
 
+extern "C"
+{
 typedef struct gncp_column_view_edit gnc_column_view_edit;
 
 GtkWidget * gnc_column_view_edit_options(GncOptionDB* odb, SCM view);
diff --git a/gnucash/gnome/dialog-report-style-sheet.cpp b/gnucash/gnome/dialog-report-style-sheet.cpp
index ec405b630..f3ac6383f 100644
--- a/gnucash/gnome/dialog-report-style-sheet.cpp
+++ b/gnucash/gnome/dialog-report-style-sheet.cpp
@@ -28,8 +28,6 @@
 #include <gnc-optiondb.h>
 #include <libguile.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include "dialog-report-style-sheet.h"
@@ -41,7 +39,6 @@ extern "C"
 #include "gnc-guile-utils.h"
 #include "gnc-ui.h"
 #include <guile-mappings.h>
-}
 #include "gnc-report.h"
 
 #define DIALOG_STYLE_SHEETS_CM_CLASS "style-sheets-dialog"
diff --git a/gnucash/gnome/gnc-plugin-page-report.cpp b/gnucash/gnome/gnc-plugin-page-report.cpp
index a9f1b24fd..184a7971a 100644
--- a/gnucash/gnome/gnc-plugin-page-report.cpp
+++ b/gnucash/gnome/gnc-plugin-page-report.cpp
@@ -42,8 +42,6 @@
 #include <gnc-optiondb-impl.hpp>
 #include <libguile.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <sys/stat.h>
@@ -76,8 +74,6 @@ extern "C"
 #include "guile-mappings.h"
 #include "gnc-icons.h"
 #include "print-session.h"
-}
-
 
 #include <memory>
 #include <gnc-report.h>
diff --git a/gnucash/gnome/top-level.h b/gnucash/gnome/top-level.h
index 64a483f4c..3170e3564 100644
--- a/gnucash/gnome/top-level.h
+++ b/gnucash/gnome/top-level.h
@@ -25,6 +25,14 @@
 
 #include <glib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void gnc_main_gui_init(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnome/window-report.cpp b/gnucash/gnome/window-report.cpp
index 7b4e7c159..2a0c3ea37 100644
--- a/gnucash/gnome/window-report.cpp
+++ b/gnucash/gnome/window-report.cpp
@@ -30,8 +30,6 @@
 #include "dialog-report-column-view.hpp"
 #include <libguile.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <errno.h>
@@ -44,7 +42,6 @@ extern "C"
 #include "guile-mappings.h"
 
 #include "gnc-plugin-page-report.h"
-}
 #include "gnc-report.h"
 
 /********************************************************************
diff --git a/gnucash/gnucash-cli.cpp b/gnucash/gnucash-cli.cpp
index edcf33d6c..e85f252ee 100644
--- a/gnucash/gnucash-cli.cpp
+++ b/gnucash/gnucash-cli.cpp
@@ -30,11 +30,9 @@
 #include "gnucash-commands.hpp"
 #include "gnucash-core-app.hpp"
 
-extern "C" {
 #include <glib/gi18n.h>
 #include <gnc-engine.h>
 #include <gnc-prefs.h>
-}
 
 #include <boost/locale.hpp>
 #include <boost/optional.hpp>
diff --git a/gnucash/gnucash-commands.cpp b/gnucash/gnucash-commands.cpp
index 6cfa44ca4..c60324190 100644
--- a/gnucash/gnucash-commands.cpp
+++ b/gnucash/gnucash-commands.cpp
@@ -32,14 +32,12 @@
 #include "gnucash-commands.hpp"
 #include "gnucash-core-app.hpp"
 
-extern "C" {
 #include <gnc-engine-guile.h>
 #include <gnc-prefs.h>
 #include <gnc-prefs-utils.h>
 #include <gnc-gnome-utils.h>
 #include <gnc-session.h>
 #include <qoflog.h>
-}
 
 #include <boost/locale.hpp>
 #include <fstream>
diff --git a/gnucash/gnucash-core-app.cpp b/gnucash/gnucash-core-app.cpp
index 69f7a5d08..1687293b1 100644
--- a/gnucash/gnucash-core-app.cpp
+++ b/gnucash/gnucash-core-app.cpp
@@ -31,7 +31,6 @@
 
 #include "gnucash-core-app.hpp"
 
-extern "C" {
 #include <glib/gi18n.h>
 #include <binreloc.h>
 #include <gnc-engine.h>
@@ -45,7 +44,6 @@ extern "C" {
 #include <gnc-splash.h>
 #include <gnc-version.h>
 #include "gnucash-locale-platform.h"
-}
 
 #include <boost/algorithm/string.hpp>
 #include <boost/locale.hpp>
diff --git a/gnucash/gnucash-locale-platform.h b/gnucash/gnucash-locale-platform.h
index 737a99b30..bfdddc8ff 100644
--- a/gnucash/gnucash-locale-platform.h
+++ b/gnucash/gnucash-locale-platform.h
@@ -25,6 +25,14 @@
 #ifndef GNUCASH_LOCALE_PLATFORM_H
 #define GNUCASH_LOCALE_PLATFORM_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 char *set_platform_locale(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/gnucash.cpp b/gnucash/gnucash.cpp
index ea72ab4c1..d3fea5b31 100644
--- a/gnucash/gnucash.cpp
+++ b/gnucash/gnucash.cpp
@@ -32,7 +32,6 @@
 #include "gnucash-commands.hpp"
 #include "gnucash-core-app.hpp"
 
-extern "C" {
 #include <glib/gi18n.h>
 #include <dialog-new-user.h>
 #include <gfec.h>
@@ -59,7 +58,6 @@ extern "C" {
 #include <gnucash-register.h>
 #include <search-core-type.h>
 #include <top-level.h>
-}
 
 #include <boost/locale.hpp>
 #include <boost/optional.hpp>
diff --git a/gnucash/html/gnc-html-factory.h b/gnucash/html/gnc-html-factory.h
index 947e6ed6c..dcf6db1f3 100644
--- a/gnucash/html/gnc-html-factory.h
+++ b/gnucash/html/gnc-html-factory.h
@@ -25,6 +25,14 @@
 
 #include "gnc-html.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 GncHtml* gnc_html_factory_create_html( void );
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/html/gnc-html-history.h b/gnucash/html/gnc-html-history.h
index e4fdfd31d..87c93a08b 100644
--- a/gnucash/html/gnc-html-history.h
+++ b/gnucash/html/gnc-html-history.h
@@ -28,6 +28,10 @@ typedef struct _gnc_html_history gnc_html_history;
 
 #include "gnc-html.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct _gnc_html_history_node
 {
     char* type;
@@ -59,6 +63,10 @@ gnc_html_history_node * gnc_html_history_node_new(URLType type,
 void                    gnc_html_history_node_destroy(gnc_html_history_node *
         node);
 
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif
 
diff --git a/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp
index ea90fbd0f..7b86adb2e 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp
+++ b/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp
@@ -29,8 +29,6 @@
 
 #include <guid.hpp>
 
-extern "C"
-{
 #include "config.h"
 
 #include <gtk/gtk.h>
@@ -50,7 +48,6 @@ extern "C"
 
 #include "gnc-csv-gnumeric-popup.h"
 #include "go-charmap-sel.h"
-}
 
 #include <algorithm>
 #include <exception>
diff --git a/gnucash/import-export/csv-imp/assistant-csv-price-import.h b/gnucash/import-export/csv-imp/assistant-csv-price-import.h
index 213b622e2..d81e69877 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-price-import.h
+++ b/gnucash/import-export/csv-imp/assistant-csv-price-import.h
@@ -28,9 +28,17 @@
 #ifndef GNC_ASSISTANT_CSV_IMPORT_PRICE_H
 #define GNC_ASSISTANT_CSV_IMPORT_PRICE_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /** The gnc_file_csv_price_import() will let the user import the
  *  commodity prices from a file.
  */
 void gnc_file_csv_price_import (void);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
index 1b0f48958..db822d6fd 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
+++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
@@ -30,8 +30,6 @@
 
 #include <guid.hpp>
 
-extern "C"
-{
 #include <config.h>
 
 #include <gtk/gtk.h>
@@ -57,7 +55,6 @@ extern "C"
 
 #include "gnc-csv-gnumeric-popup.h"
 #include "go-charmap-sel.h"
-}
 
 #include "gnc-imp-settings-csv-tx.hpp"
 #include "gnc-import-tx.hpp"
diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.h b/gnucash/import-export/csv-imp/assistant-csv-trans-import.h
index e51f32992..c98e253b6 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.h
+++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.h
@@ -29,8 +29,17 @@
 #define GNC_ASSISTANT_CSV_IMPORT_TRANS_H
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** The gnc_file_csv_trans_import() will let the user import the
  *  account tree or transactions to a delimited file.
  */
 void gnc_file_csv_trans_import (void);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/import-export/csv-imp/gnc-csv-account-map.h b/gnucash/import-export/csv-imp/gnc-csv-account-map.h
index 976a66119..726d9e4d6 100644
--- a/gnucash/import-export/csv-imp/gnc-csv-account-map.h
+++ b/gnucash/import-export/csv-imp/gnc-csv-account-map.h
@@ -30,6 +30,10 @@
 #include <gtk/gtk.h>
 #include "Account.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Enumeration for the mappings liststore */
 enum GncImportColumn {MAPPING_STRING, MAPPING_FULLPATH, MAPPING_ACCOUNT};
 
@@ -49,4 +53,8 @@ void gnc_csv_account_map_change_mappings (Account *old_account, Account *new_acc
  */
 Account * gnc_csv_account_map_search (const gchar *map_string);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/import-export/csv-imp/gnc-csv-gnumeric-popup.h b/gnucash/import-export/csv-imp/gnc-csv-gnumeric-popup.h
index d5f6d150e..233520f95 100644
--- a/gnucash/import-export/csv-imp/gnc-csv-gnumeric-popup.h
+++ b/gnucash/import-export/csv-imp/gnc-csv-gnumeric-popup.h
@@ -72,6 +72,10 @@
 
 #include <gtk/gtk.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct
 {
     char const *name;
@@ -95,5 +99,9 @@ void gnumeric_create_popup_menu (GnumericPopupMenuElement const *elements,
                                  int sensitive_filter,
                                  GdkEventButton *event);
 
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif
diff --git a/gnucash/import-export/csv-imp/gnc-imp-props-price.cpp b/gnucash/import-export/csv-imp/gnc-imp-props-price.cpp
index cbeedfce9..c9e29f8bd 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-props-price.cpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-props-price.cpp
@@ -24,7 +24,6 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
-extern "C" {
 #include <platform.h>
 #if PLATFORM(WINDOWS)
 #include <windows.h>
@@ -32,7 +31,6 @@ extern "C" {
 
 #include "engine-helpers.h"
 #include "gnc-ui-util.h"
-}
 
 #include <exception>
 #include <map>
diff --git a/gnucash/import-export/csv-imp/gnc-imp-props-price.hpp b/gnucash/import-export/csv-imp/gnc-imp-props-price.hpp
index 38acdd077..9d2a4a9d6 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-props-price.hpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-props-price.hpp
@@ -24,7 +24,6 @@
 #ifndef GNC_PRICE_PROPS_HPP
 #define GNC_PRICE_PROPS_HPP
 
-extern "C" {
 #include <platform.h>
 #if PLATFORM(WINDOWS)
 #include <windows.h>
@@ -33,7 +32,6 @@ extern "C" {
 #include <glib/gi18n.h>
 #include "gnc-pricedb.h"
 #include "gnc-commodity.h"
-}
 
 #include <string>
 #include <map>
diff --git a/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp b/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
index 8196856c6..8fbfc0d93 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
@@ -23,13 +23,11 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
-extern "C" {
 #include <platform.h>
 #if PLATFORM(WINDOWS)
 #include <windows.h>
 #endif
 
-
 #include "engine-helpers.h"
 #include "gnc-csv-account-map.h"
 #include "gnc-ui-util.h"
@@ -38,8 +36,6 @@ extern "C" {
 #include "gnc-pricedb.h"
 #include <gnc-exp-parser.h>
 
-}
-
 #include <algorithm>
 #include <exception>
 #include <map>
diff --git a/gnucash/import-export/csv-imp/gnc-imp-props-tx.hpp b/gnucash/import-export/csv-imp/gnc-imp-props-tx.hpp
index faf8cea75..5999fb725 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-props-tx.hpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-props-tx.hpp
@@ -24,7 +24,6 @@
 #ifndef GNC_TRANS_PROPS_HPP
 #define GNC_TRANS_PROPS_HPP
 
-extern "C" {
 #include <platform.h>
 #if PLATFORM(WINDOWS)
 #include <windows.h>
@@ -35,7 +34,6 @@ extern "C" {
 #include "Account.h"
 #include "Transaction.h"
 #include "gnc-commodity.h"
-}
 
 #include <string>
 #include <map>
diff --git a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.cpp b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.cpp
index d55d6cc11..fe2e5296b 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.cpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.cpp
@@ -34,8 +34,6 @@
 #include <string>
 #include <vector>
 
-extern "C"
-{
 #include <config.h>
 
 #include <gtk/gtk.h>
@@ -44,7 +42,6 @@ extern "C"
 #include "Account.h"
 #include "gnc-state.h"
 #include "gnc-ui-util.h"
-}
 
 constexpr auto group_prefix = "Import csv,price - ";
 
diff --git a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.hpp b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.hpp
index ef15cdd29..38f1f7fc2 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.hpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.hpp
@@ -28,11 +28,9 @@
 #ifndef GNC_CSV_PRICE_IMPORT_SETTINGS_H
 #define GNC_CSV_PRICE_IMPORT_SETTINGS_H
 
-extern "C" {
 #include <config.h>
 #include "Account.h"
 #include "gnc-commodity.h"
-}
 
 #include <string>
 #include <vector>
diff --git a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.cpp b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.cpp
index f7c89f8c5..c86760537 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.cpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.cpp
@@ -34,8 +34,6 @@
 #include <string>
 #include <vector>
 
-extern "C"
-{
 #include <config.h>
 
 #include <gtk/gtk.h>
@@ -44,7 +42,6 @@ extern "C"
 #include "Account.h"
 #include "gnc-state.h"
 #include "gnc-ui-util.h"
-}
 
 constexpr auto group_prefix = "Import csv,transaction - ";
 
diff --git a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.hpp b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.hpp
index 8d798f7f1..bc23e15db 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.hpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.hpp
@@ -28,11 +28,9 @@
 #ifndef GNC_CSV_TRANS_IMPORT_SETTINGS_H
 #define GNC_CSV_TRANS_IMPORT_SETTINGS_H
 
-extern "C" {
 #include <config.h>
 #include "Account.h"
 #include "gnc-commodity.h"
-}
 
 #include <string>
 #include <vector>
diff --git a/gnucash/import-export/csv-imp/gnc-imp-settings-csv.cpp b/gnucash/import-export/csv-imp/gnc-imp-settings-csv.cpp
index 694b5b98e..7bd8e4432 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-settings-csv.cpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-settings-csv.cpp
@@ -29,8 +29,6 @@
 #include "gnc-imp-settings-csv.hpp"
 #include <sstream>
 
-extern "C"
-{
 #include <config.h>
 
 #include <gtk/gtk.h>
@@ -39,7 +37,6 @@ extern "C"
 #include "Account.h"
 #include "gnc-state.h"
 #include "gnc-ui-util.h"
-}
 
 #include <algorithm>
 #include <iostream>
diff --git a/gnucash/import-export/csv-imp/gnc-imp-settings-csv.hpp b/gnucash/import-export/csv-imp/gnc-imp-settings-csv.hpp
index fa283bfbd..bb344ce39 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-settings-csv.hpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-settings-csv.hpp
@@ -28,11 +28,9 @@
 #ifndef GNC_CSV_IMPORT_SETTINGS_H
 #define GNC_CSV_IMPORT_SETTINGS_H
 
-extern "C" {
 #include <config.h>
 #include "Account.h"
 #include "gnc-commodity.h"
-}
 
 #include <string>
 #include <vector>
diff --git a/gnucash/import-export/csv-imp/gnc-import-price.cpp b/gnucash/import-export/csv-imp/gnc-import-price.cpp
index 73925eefe..8368b921c 100644
--- a/gnucash/import-export/csv-imp/gnc-import-price.cpp
+++ b/gnucash/import-export/csv-imp/gnc-import-price.cpp
@@ -22,7 +22,6 @@
 
 #include <guid.hpp>
 
-extern "C" {
 #include <platform.h>
 #if PLATFORM(WINDOWS)
 #include <windows.h>
@@ -33,7 +32,6 @@ extern "C" {
 #include "gnc-ui-util.h" //get book
 #include "gnc-commodity.h"
 #include "gnc-pricedb.h"
-}
 
 #include <algorithm>
 #include <exception>
diff --git a/gnucash/import-export/csv-imp/gnc-import-price.hpp b/gnucash/import-export/csv-imp/gnc-import-price.hpp
index 38f54cc59..56af0852c 100644
--- a/gnucash/import-export/csv-imp/gnc-import-price.hpp
+++ b/gnucash/import-export/csv-imp/gnc-import-price.hpp
@@ -30,10 +30,8 @@
 #ifndef GNC_PRICE_IMPORT_HPP
 #define GNC_PRICE_IMPORT_HPP
 
-extern "C" {
 #include "config.h"
 #include "gnc-commodity.h"
-}
 
 #include <vector>
 #include <set>
diff --git a/gnucash/import-export/csv-imp/gnc-import-tx.cpp b/gnucash/import-export/csv-imp/gnc-import-tx.cpp
index 459cbfcb1..e70a1237c 100644
--- a/gnucash/import-export/csv-imp/gnc-import-tx.cpp
+++ b/gnucash/import-export/csv-imp/gnc-import-tx.cpp
@@ -23,14 +23,12 @@
 
 #include <guid.hpp>
 
-extern "C" {
 #include <platform.h>
 #if PLATFORM(WINDOWS)
 #include <windows.h>
 #endif
 
 #include <glib/gi18n.h>
-}
 
 #include <algorithm>
 #include <exception>
diff --git a/gnucash/import-export/csv-imp/gnc-import-tx.hpp b/gnucash/import-export/csv-imp/gnc-import-tx.hpp
index ffa8a035a..aa3e881c6 100644
--- a/gnucash/import-export/csv-imp/gnc-import-tx.hpp
+++ b/gnucash/import-export/csv-imp/gnc-import-tx.hpp
@@ -29,12 +29,10 @@
 #ifndef GNC_TX_IMPORT_HPP
 #define GNC_TX_IMPORT_HPP
 
-extern "C" {
 #include <config.h>
 
 #include "Account.h"
 #include "Transaction.h"
-}
 
 #include <vector>
 #include <set>
diff --git a/gnucash/import-export/csv-imp/gnc-tokenizer-csv.cpp b/gnucash/import-export/csv-imp/gnc-tokenizer-csv.cpp
index 8f116e407..5a8aa93e9 100644
--- a/gnucash/import-export/csv-imp/gnc-tokenizer-csv.cpp
+++ b/gnucash/import-export/csv-imp/gnc-tokenizer-csv.cpp
@@ -11,9 +11,7 @@
 #include <boost/locale.hpp>
 #include <boost/algorithm/string.hpp>
 
-extern "C" {
-    #include <glib/gi18n.h>
-}
+#include <glib/gi18n.h>
 
 void
 GncCsvTokenizer::set_separators(const std::string& separators)
diff --git a/gnucash/import-export/csv-imp/gnc-tokenizer-csv.hpp b/gnucash/import-export/csv-imp/gnc-tokenizer-csv.hpp
index ef75632e6..c60910b5a 100644
--- a/gnucash/import-export/csv-imp/gnc-tokenizer-csv.hpp
+++ b/gnucash/import-export/csv-imp/gnc-tokenizer-csv.hpp
@@ -34,9 +34,7 @@
 #ifndef GNC_CSV_TOKENIZER_HPP
 #define GNC_CSV_TOKENIZER_HPP
 
-extern "C" {
 #include <config.h>
-}
 
 #include <iostream>
 #include <fstream>      // fstream
diff --git a/gnucash/import-export/csv-imp/gnc-tokenizer-dummy.hpp b/gnucash/import-export/csv-imp/gnc-tokenizer-dummy.hpp
index 5bedfee3b..dffb64a6d 100644
--- a/gnucash/import-export/csv-imp/gnc-tokenizer-dummy.hpp
+++ b/gnucash/import-export/csv-imp/gnc-tokenizer-dummy.hpp
@@ -35,9 +35,7 @@
 #ifndef GNC_DUMMY_TOKENIZER_HPP
 #define GNC_DUMMY_TOKENIZER_HPP
 
-extern "C" {
 #include <config.h>
-}
 
 #include <iostream>
 #include <fstream>      // fstream
diff --git a/gnucash/import-export/csv-imp/gnc-tokenizer-fw.hpp b/gnucash/import-export/csv-imp/gnc-tokenizer-fw.hpp
index d2eca2e79..e34c55de1 100644
--- a/gnucash/import-export/csv-imp/gnc-tokenizer-fw.hpp
+++ b/gnucash/import-export/csv-imp/gnc-tokenizer-fw.hpp
@@ -37,9 +37,7 @@
 #ifndef GNC_FW_TOKENIZER_HPP
 #define GNC_FW_TOKENIZER_HPP
 
-extern "C" {
 #include <config.h>
-}
 
 #include <iostream>
 #include <fstream>      // fstream
diff --git a/gnucash/import-export/csv-imp/gnc-tokenizer.cpp b/gnucash/import-export/csv-imp/gnc-tokenizer.cpp
index 2f54db6aa..d14ead25b 100644
--- a/gnucash/import-export/csv-imp/gnc-tokenizer.cpp
+++ b/gnucash/import-export/csv-imp/gnc-tokenizer.cpp
@@ -14,11 +14,9 @@
 #include <boost/locale.hpp>
 #include <boost/algorithm/string.hpp>
 
-extern "C" {
 #include <go-glib-extras.h>
 #include <glib.h>
 #include <glib/gstdio.h>
-}
 
 std::unique_ptr<GncTokenizer> gnc_tokenizer_factory(GncImpFileFormat fmt)
 {
diff --git a/gnucash/import-export/csv-imp/gnc-tokenizer.hpp b/gnucash/import-export/csv-imp/gnc-tokenizer.hpp
index fb68bd33e..8ad0bd27c 100644
--- a/gnucash/import-export/csv-imp/gnc-tokenizer.hpp
+++ b/gnucash/import-export/csv-imp/gnc-tokenizer.hpp
@@ -35,9 +35,7 @@
 #ifndef GNC_TOKENIZER_HPP
 #define GNC_TOKENIZER_HPP
 
-extern "C" {
 #include <config.h>
-}
 
 #include <iostream>
 #include <fstream>      // fstream
diff --git a/gnucash/import-export/import-account-matcher.h b/gnucash/import-export/import-account-matcher.h
index 4e39515a0..a7d9be613 100644
--- a/gnucash/import-export/import-account-matcher.h
+++ b/gnucash/import-export/import-account-matcher.h
@@ -35,6 +35,10 @@
 
 #include "gnc-tree-view-account.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct
 {
     GtkWidget           *dialog;                         /* Dialog Widget */
@@ -125,5 +129,9 @@ Account * gnc_import_select_account(GtkWidget *parent,
                                     gboolean * ok_pressed
                                    );
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 /**@}*/
diff --git a/gnucash/import-export/import-backend.h b/gnucash/import-export/import-backend.h
index cb9c72663..d19d03a16 100644
--- a/gnucash/import-export/import-backend.h
+++ b/gnucash/import-export/import-backend.h
@@ -31,6 +31,10 @@
 #include "Transaction.h"
 #include "import-settings.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct _transactioninfo GNCImportTransInfo;
 typedef struct _selected_match_info GNCImportSelectedMatchInfo;
 typedef struct _matchinfo
@@ -259,6 +263,10 @@ gint
 gnc_import_MatchInfo_get_probability (const GNCImportMatchInfo * info);
 /**@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 /** @} */
 
diff --git a/gnucash/import-export/import-main-matcher.h b/gnucash/import-export/import-main-matcher.h
index 51ddf4f53..87eff3f39 100644
--- a/gnucash/import-export/import-main-matcher.h
+++ b/gnucash/import-export/import-main-matcher.h
@@ -36,6 +36,10 @@
 #include "Transaction.h"
 #include "import-backend.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct _main_matcher_info GNCImportMainMatcher;
 
 typedef void (*GNCTransactionProcessedCB) (GNCImportTransInfo *trans_info,
@@ -221,5 +225,9 @@ void gnc_gen_trans_list_show_reconcile_after_close_button (GNCImportMainMatcher
  */
 GtkWidget* gnc_gen_trans_list_get_reconcile_after_close_button (GNCImportMainMatcher *info);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 /**@}*/
diff --git a/gnucash/import-export/import-pending-matches.h b/gnucash/import-export/import-pending-matches.h
index 57530b1ac..70a6f4724 100644
--- a/gnucash/import-export/import-pending-matches.h
+++ b/gnucash/import-export/import-pending-matches.h
@@ -29,6 +29,10 @@
 #include <glib.h>
 #include "import-backend.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef GHashTable GNCImportPendingMatches;
 
 typedef enum _import_match_type {
@@ -58,5 +62,9 @@ gnc_import_PendingMatches_get_match_type(GNCImportPendingMatches *map,
 const char *
 gnc_import_PendingMatches_get_type_str(GNCImportPendingMatchType type);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 /** @} */
diff --git a/gnucash/import-export/test/gtest-import-account-matcher.cpp b/gnucash/import-export/test/gtest-import-account-matcher.cpp
index 004c564f7..1c643416e 100644
--- a/gnucash/import-export/test/gtest-import-account-matcher.cpp
+++ b/gnucash/import-export/test/gtest-import-account-matcher.cpp
@@ -23,15 +23,12 @@
  *******************************************************************/
 
 #include <gtest/gtest.h>
-extern "C"
-{
 #include <config.h>
 #include <import-account-matcher.h>
 #include <gnc-session.h>
 #include <qofbook.h>
 #include <Account.h>
 #include <gtk/gtk.h>
-}
 #include <vector>
 
 using AccountV = std::vector<const Account*>;
diff --git a/gnucash/import-export/test/gtest-import-backend.cpp b/gnucash/import-export/test/gtest-import-backend.cpp
index 6909a3351..9c77f1844 100644
--- a/gnucash/import-export/test/gtest-import-backend.cpp
+++ b/gnucash/import-export/test/gtest-import-backend.cpp
@@ -6,12 +6,9 @@
 
 #include <gnc-datetime.hpp>
 
-extern "C"
-{
 #include <import-backend.h>
 #include <engine-helpers.h>
 #include <gnc-ui-util.h>
-}
 
 #include "gmock-gnc-prefs.h"
 #include "gmock-qofbook.h"
diff --git a/gnucash/import-export/test/test-import-pending-matches.cpp b/gnucash/import-export/test/test-import-pending-matches.cpp
index 56a52d392..c633f256a 100644
--- a/gnucash/import-export/test/test-import-pending-matches.cpp
+++ b/gnucash/import-export/test/test-import-pending-matches.cpp
@@ -1,7 +1,6 @@
 #include <glib.h>
 #include <gtk/gtk.h> /* for references in import-backend.h */
 
-extern "C" {
 #include <config.h>
 #include <unittest-support.h>
 
@@ -9,7 +8,6 @@ extern "C" {
 #include "import-pending-matches.h"
 #include "Split.h"
 #include "test-engine-stuff.h"
-}
 
 static const gchar *suitename = "/import-export/import-pending-matches";
 
diff --git a/gnucash/register/register-gnome/gnucash-register.h b/gnucash/register/register-gnome/gnucash-register.h
index 9dd839df9..dde62e31b 100644
--- a/gnucash/register/register-gnome/gnucash-register.h
+++ b/gnucash/register/register-gnome/gnucash-register.h
@@ -26,6 +26,10 @@
 #include "table-allgui.h"
 #include "gnucash-sheet.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @ingroup Register
  * @addtogroup Gnome
  * @{
@@ -87,4 +91,9 @@ void gnucash_register_set_open_doclink_cb (GnucashRegister *reg,
 GnucashSheet *gnucash_register_get_sheet (GnucashRegister *reg);
 void gnucash_register_reset_sheet_layout (GnucashRegister *reg);
 /** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/gnucash/report/gnc-report.cpp b/gnucash/report/gnc-report.cpp
index 6dffdf4a3..33b4aa822 100644
--- a/gnucash/report/gnc-report.cpp
+++ b/gnucash/report/gnc-report.cpp
@@ -31,8 +31,6 @@
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
 #include <libguile.h>
-extern "C"
-{
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
@@ -43,7 +41,6 @@ extern "C"
 #include <gnc-filepath-utils.h>
 #include <gnc-guile-utils.h>
 #include <gnc-engine.h>
-}
 #include "gnc-report.h"
 
 extern "C" SCM scm_init_sw_report_module(void);
diff --git a/libgnucash/app-utils/QuickFill.h b/libgnucash/app-utils/QuickFill.h
index 4fd125319..d9d33fe50 100644
--- a/libgnucash/app-utils/QuickFill.h
+++ b/libgnucash/app-utils/QuickFill.h
@@ -52,6 +52,10 @@
 
 #include <glib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum
 {
     QUICKFILL_LIFO,
@@ -127,4 +131,8 @@ void         gnc_quickfill_remove (QuickFill *root, const gchar *text,
 
 /** @} */
 /** @} */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* QUICKFILL_H */
diff --git a/libgnucash/app-utils/gfec.h b/libgnucash/app-utils/gfec.h
index b1ecc30b6..b7b026e34 100644
--- a/libgnucash/app-utils/gfec.h
+++ b/libgnucash/app-utils/gfec.h
@@ -13,6 +13,10 @@
 #include <glib.h>
 #include "guile-mappings.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef void (*gfec_error_handler)(const char *error_message);
 
 SCM gfec_eval_file(const char *file, gfec_error_handler error_handler);
@@ -20,4 +24,8 @@ SCM gfec_eval_string(const char *str, gfec_error_handler error_handler);
 SCM gfec_apply(SCM proc, SCM arglist, gfec_error_handler error_handler);
 gboolean gfec_try_load(const gchar *fn);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/libgnucash/app-utils/gnc-account-merge.h b/libgnucash/app-utils/gnc-account-merge.h
index 0a7c34dba..bace53304 100644
--- a/libgnucash/app-utils/gnc-account-merge.h
+++ b/libgnucash/app-utils/gnc-account-merge.h
@@ -23,6 +23,10 @@
 
 #include "Account.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum
 {
     GNC_ACCOUNT_MERGE_DISPOSITION_USE_EXISTING,
@@ -41,4 +45,8 @@ GncAccountMergeDisposition determine_merge_disposition(Account *existing_root, A
 
 void account_trees_merge(Account *existing_root, Account *new_accts_root);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_ACCOUNT_MERGE_H */
diff --git a/libgnucash/app-utils/gnc-exp-parser.h b/libgnucash/app-utils/gnc-exp-parser.h
index 88651f002..88d598213 100644
--- a/libgnucash/app-utils/gnc-exp-parser.h
+++ b/libgnucash/app-utils/gnc-exp-parser.h
@@ -24,6 +24,10 @@
 
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * The errors which can be determined at the gnc-exp-parser level.
  **/
@@ -89,4 +93,8 @@ gboolean gnc_exp_parser_parse_separate_vars (const char * expression,
  * the problem. Otherwise, return NULL. */
 const char * gnc_exp_parser_error_string (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp
index 58b1bd599..50b55392a 100644
--- a/libgnucash/app-utils/gnc-gsettings.cpp
+++ b/libgnucash/app-utils/gnc-gsettings.cpp
@@ -28,14 +28,12 @@
 #include <gio/gio.h>
 #include <glib.h>
 
-extern "C" {
 #include <stdio.h>
 #include <string.h>
 #include "gnc-gsettings.h"
 #include "gnc-path.h"
 #include "qof.h"
 #include "gnc-prefs-p.h"
-}
 
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/xml_parser.hpp>
diff --git a/libgnucash/app-utils/gnc-gsettings.h b/libgnucash/app-utils/gnc-gsettings.h
index 7f2d9f3a0..f02815f00 100644
--- a/libgnucash/app-utils/gnc-gsettings.h
+++ b/libgnucash/app-utils/gnc-gsettings.h
@@ -52,6 +52,10 @@
 
 #include <glib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Convert a partial schema name into a complete gsettings schema name.
  *
  *  This function takes a partial gsettings schema name and converts
@@ -605,6 +609,10 @@ void gnc_gsettings_load_backend (void);
  */
 void gnc_gsettings_version_upgrade (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_GSETTINGS_H */
 /** @} */
 /** @} */
diff --git a/libgnucash/app-utils/gnc-prefs-utils.h b/libgnucash/app-utils/gnc-prefs-utils.h
index 1eaf935eb..581fcdcd6 100644
--- a/libgnucash/app-utils/gnc-prefs-utils.h
+++ b/libgnucash/app-utils/gnc-prefs-utils.h
@@ -42,6 +42,10 @@
 #define GNC_PREFS_UTILS_H_
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** This function is called early in the load process
  *  to preload a number of preferences from the settings backend
  */
@@ -52,6 +56,10 @@ void gnc_prefs_init (void);
  */
 void gnc_prefs_remove_registered (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_PREFS_UTILS_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/app-utils/gnc-quotes.cpp b/libgnucash/app-utils/gnc-quotes.cpp
index 0f71f20ad..1d75084e8 100644
--- a/libgnucash/app-utils/gnc-quotes.cpp
+++ b/libgnucash/app-utils/gnc-quotes.cpp
@@ -48,7 +48,6 @@
 #include <gnc-numeric.hpp>
 #include "gnc-quotes.hpp"
 
-extern "C" {
 #include <gnc-commodity.h>
 #include <gnc-path.h>
 #include "gnc-ui-util.h"
@@ -56,7 +55,6 @@ extern "C" {
 #include <gnc-session.h>
 #include <regex.h>
 #include <qofbook.h>
-}
 
 static const QofLogModule log_module = "gnc.price-quotes";
 
diff --git a/libgnucash/app-utils/gnc-state.h b/libgnucash/app-utils/gnc-state.h
index 2cf0d7b94..624813c39 100644
--- a/libgnucash/app-utils/gnc-state.h
+++ b/libgnucash/app-utils/gnc-state.h
@@ -54,6 +54,10 @@
 
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Definitions shared by file-utils.c and gnc-main-window.c */
 #define STATE_FILE_TOP           "Top"
 #define STATE_FILE_BOOK_GUID     "BookGuid"
@@ -102,6 +106,10 @@ GKeyFile *gnc_state_get_current (void);
  */
 gint gnc_state_drop_sections_for (const gchar *partial_name);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_STATE_H */
 /** @} */
 /** @} */
diff --git a/libgnucash/app-utils/gnc-ui-util.h b/libgnucash/app-utils/gnc-ui-util.h
index 3c137371d..54cd23306 100644
--- a/libgnucash/app-utils/gnc-ui-util.h
+++ b/libgnucash/app-utils/gnc-ui-util.h
@@ -39,6 +39,10 @@
 #include "gncOwner.h"
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 typedef QofSession * (*QofSessionCB) (void);
 
@@ -434,6 +438,10 @@ gchar * gnc_filter_text_for_currency_commodity (const gnc_commodity *comm,
                                                 const gchar *incoming_text,
                                                 const gchar **symbol);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 /** @} */
 /** @} */
diff --git a/libgnucash/app-utils/test/gtest-gnc-quotes.cpp b/libgnucash/app-utils/test/gtest-gnc-quotes.cpp
index 3f1136e80..f9c165172 100644
--- a/libgnucash/app-utils/test/gtest-gnc-quotes.cpp
+++ b/libgnucash/app-utils/test/gtest-gnc-quotes.cpp
@@ -22,8 +22,6 @@
  *                                                                  *
 \********************************************************************/
 
-extern "C"
-{
 #include <config.h>
 #include <gnc-session.h>
 #include <gnc-commodity.h>
@@ -31,6 +29,7 @@ extern "C"
 #include <qof.h>
 
 /* gnc-quotes normally gets this from gnc-ui-util, but let's avoid the dependency. */
+extern "C" {
 static gnc_commodity*
 gnc_default_currency(void)
 {
@@ -38,8 +37,8 @@ gnc_default_currency(void)
     auto table{gnc_commodity_table_get_table(book)};
     return gnc_commodity_table_lookup(table, GNC_COMMODITY_NS_CURRENCY, "USD");
 }
+}
 
-} // extern "C"
 #include <gtest/gtest.h>
 #include "../gnc-quotes.cpp"
 
diff --git a/libgnucash/app-utils/test/test-print-parse-amount.cpp b/libgnucash/app-utils/test/test-print-parse-amount.cpp
index 8dea72099..a4ab4683e 100644
--- a/libgnucash/app-utils/test/test-print-parse-amount.cpp
+++ b/libgnucash/app-utils/test/test-print-parse-amount.cpp
@@ -21,8 +21,6 @@
 #include <glib.h>
 #include <glib/gprintf.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 
@@ -31,7 +29,6 @@ extern "C"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
 #include <unittest-support.h>
-}
 
 static void
 test_num_print_info (gnc_numeric n, GNCPrintAmountInfo print_info, int line)
diff --git a/libgnucash/app-utils/test/test-sx.cpp b/libgnucash/app-utils/test/test-sx.cpp
index 7047deb1f..b38fc22e8 100644
--- a/libgnucash/app-utils/test/test-sx.cpp
+++ b/libgnucash/app-utils/test/test-sx.cpp
@@ -22,8 +22,6 @@
 #include <glib.h>
 #include <libguile.h>
 
-extern "C"
-{
 #include <stdlib.h>
 #include "SX-book.h"
 #include "SX-ttinfo.h"
@@ -34,7 +32,6 @@ extern "C"
 
 #include "test-stuff.h"
 #include "test-engine-stuff.h"
-}
 
 static void
 test_basic()
diff --git a/libgnucash/backend/dbi/gnc-backend-dbi.cpp b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
index 11030e19d..a616e9f0d 100644
--- a/libgnucash/backend/dbi/gnc-backend-dbi.cpp
+++ b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
@@ -28,8 +28,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include "config.h"
 
 #include <platform.h>
@@ -60,8 +58,6 @@ extern "C"
 #include "splint-defs.h"
 #endif
 
-}
-
 #include <boost/regex.hpp>
 #include <string>
 #include <iomanip>
diff --git a/libgnucash/backend/dbi/gnc-backend-dbi.hpp b/libgnucash/backend/dbi/gnc-backend-dbi.hpp
index f02d59007..cc3893cfc 100644
--- a/libgnucash/backend/dbi/gnc-backend-dbi.hpp
+++ b/libgnucash/backend/dbi/gnc-backend-dbi.hpp
@@ -22,8 +22,7 @@
 /* Private structures and variables for gnc-backend-dbi.c and its unit tests */
 #ifndef GNC_BACKEND_DBI_HPP
 #define GNC_BACKEND_DBI_HPP
-extern "C"
-{
+
 #include <dbi/dbi.h>
 #ifdef G_OS_WIN32
 #include <winsock2.h>
@@ -33,7 +32,7 @@ extern "C"
 #include <unistd.h>
 #define GETPID() getpid()
 #endif
-}
+
 #include <gnc-sql-backend.hpp>
 #include <gnc-sql-connection.hpp>
 
diff --git a/libgnucash/backend/dbi/gnc-dbiprovider.hpp b/libgnucash/backend/dbi/gnc-dbiprovider.hpp
index 7f416a24e..28bc96b38 100644
--- a/libgnucash/backend/dbi/gnc-dbiprovider.hpp
+++ b/libgnucash/backend/dbi/gnc-dbiprovider.hpp
@@ -24,10 +24,7 @@
 #ifndef __GNC_DBIPROVIDER_HPP__
 #define __GNC_DBIPROVIDER_HPP__
 
-extern "C"
-{
 #include <dbi/dbi.h>
-}
 #include <string>
 #include <vector>
 
diff --git a/libgnucash/backend/dbi/gnc-dbiproviderimpl.hpp b/libgnucash/backend/dbi/gnc-dbiproviderimpl.hpp
index 107984dd9..102801783 100644
--- a/libgnucash/backend/dbi/gnc-dbiproviderimpl.hpp
+++ b/libgnucash/backend/dbi/gnc-dbiproviderimpl.hpp
@@ -23,10 +23,8 @@
 #ifndef __GNC_DBISQLPROVIDERIMPL_HPP__
 #define __GNC_DBISQLPROVIDERIMPL_HPP__
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
-}
+
 #include <string>
 #include <algorithm>
 #include <vector>
diff --git a/libgnucash/backend/dbi/gnc-dbisqlconnection.cpp b/libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
index 3eaf4d9bc..aac47df1c 100644
--- a/libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
+++ b/libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
@@ -22,12 +22,9 @@
 \********************************************************************/
 
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 #include <platform.h>
 #include <gnc-locale-utils.h>
-}
 
 #include <string>
 #include <regex>
diff --git a/libgnucash/backend/dbi/gnc-dbisqlresult.cpp b/libgnucash/backend/dbi/gnc-dbisqlresult.cpp
index b045056ff..ba19f7338 100644
--- a/libgnucash/backend/dbi/gnc-dbisqlresult.cpp
+++ b/libgnucash/backend/dbi/gnc-dbisqlresult.cpp
@@ -22,14 +22,11 @@
 \********************************************************************/
 
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 #include <gnc-locale-utils.h>
 #include <dbi/dbi.h>
 /* For direct access to dbi data structs, sadly needed for datetime */
 #include <dbi/dbi-dev.h>
-}
 #include <cmath>
 #include <gnc-datetime.hpp>
 #include "gnc-dbisqlresult.hpp"
diff --git a/libgnucash/backend/dbi/test/test-backend-dbi-basic.cpp b/libgnucash/backend/dbi/test/test-backend-dbi-basic.cpp
index 75a86ed74..85837fe59 100644
--- a/libgnucash/backend/dbi/test/test-backend-dbi-basic.cpp
+++ b/libgnucash/backend/dbi/test/test-backend-dbi-basic.cpp
@@ -26,8 +26,6 @@
 
 #include <kvp-frame.hpp>
 
-extern "C"
-{
 #include <config.h>
 
 #include <sys/types.h>
@@ -50,15 +48,11 @@ extern "C"
 #include "gncInvoice.h"
     /* For version_control */
 #include <gnc-prefs.h>
-}
 /* For test_conn_index_functions */
 #include "../gnc-backend-dbi.hpp"
 #include "../gnc-backend-dbi.h"
-extern "C"
-{
 #include <unittest-support.h>
 #include <test-stuff.h>
-}
 
 #include <string>
 #include <vector>
diff --git a/libgnucash/backend/dbi/test/test-backend-dbi.cpp b/libgnucash/backend/dbi/test/test-backend-dbi.cpp
index acb21e40c..b88ed88d1 100644
--- a/libgnucash/backend/dbi/test/test-backend-dbi.cpp
+++ b/libgnucash/backend/dbi/test/test-backend-dbi.cpp
@@ -21,12 +21,9 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
 #include "cashobjects.h"
-}
 extern void test_suite_gnc_backend_dbi ();
 
 #define GNC_LIB_NAME_1 "gncmod-backend-dbi"
diff --git a/libgnucash/backend/dbi/test/test-dbi-business-stuff.cpp b/libgnucash/backend/dbi/test/test-dbi-business-stuff.cpp
index 2f4acfcb0..89e182321 100644
--- a/libgnucash/backend/dbi/test/test-dbi-business-stuff.cpp
+++ b/libgnucash/backend/dbi/test/test-dbi-business-stuff.cpp
@@ -22,8 +22,6 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  *  02110-1301, USA.
  */
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
 #include "cashobjects.h"
@@ -39,7 +37,6 @@ extern "C"
 #include "gncInvoice.h"
 #include "gncEmployee.h"
 #include "gncVendor.h"
-}
 
 #include "test-dbi-stuff.h"
 #include "test-dbi-business-stuff.h"
diff --git a/libgnucash/backend/dbi/test/test-dbi-stuff.cpp b/libgnucash/backend/dbi/test/test-dbi-stuff.cpp
index 9bfecada3..24f8a91c7 100644
--- a/libgnucash/backend/dbi/test/test-dbi-stuff.cpp
+++ b/libgnucash/backend/dbi/test/test-dbi-stuff.cpp
@@ -22,8 +22,6 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  *  02110-1301, USA.
  */
-extern "C"
-{
 #include <config.h>
 #include <qof.h>
 #include <cashobjects.h>
@@ -36,7 +34,6 @@ extern "C"
 #include <gnc-commodity.h>
 #include <SX-book.h>
 #include <gnc-lot.h>
-}
 
 #include <kvp-frame.hpp>
 #include "../gnc-backend-dbi.hpp"
diff --git a/libgnucash/backend/sql/gnc-account-sql.cpp b/libgnucash/backend/sql/gnc-account-sql.cpp
index f80370bbc..2552ed3bc 100644
--- a/libgnucash/backend/sql/gnc-account-sql.cpp
+++ b/libgnucash/backend/sql/gnc-account-sql.cpp
@@ -26,8 +26,6 @@
  * restoring data to/from an SQL db
  */
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib.h>
@@ -40,7 +38,6 @@ extern "C"
 #if defined( S_SPLINT_S )
 #include "splint-defs.h"
 #endif
-}
 
 #include <string>
 #include <vector>
diff --git a/libgnucash/backend/sql/gnc-address-sql.cpp b/libgnucash/backend/sql/gnc-address-sql.cpp
index 79beb8af0..7ca71473a 100644
--- a/libgnucash/backend/sql/gnc-address-sql.cpp
+++ b/libgnucash/backend/sql/gnc-address-sql.cpp
@@ -29,14 +29,11 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include "gnc-engine.h"
 
 #include "gncAddress.h"
-}
 #include <cstdlib>
 #include <cstring>
 #include <sstream>
diff --git a/libgnucash/backend/sql/gnc-bill-term-sql.cpp b/libgnucash/backend/sql/gnc-bill-term-sql.cpp
index 5f598f90c..355220cfd 100644
--- a/libgnucash/backend/sql/gnc-bill-term-sql.cpp
+++ b/libgnucash/backend/sql/gnc-bill-term-sql.cpp
@@ -28,8 +28,6 @@
  * restoring data to/from an SQL database
  */
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib.h>
@@ -39,7 +37,6 @@ extern "C"
 #include "gncBillTermP.h"
 #include "gncInvoice.h"
 #include "qof.h"
-}
 
 #include <string>
 #include <vector>
diff --git a/libgnucash/backend/sql/gnc-book-sql.cpp b/libgnucash/backend/sql/gnc-book-sql.cpp
index ca2716988..2d26ab7de 100644
--- a/libgnucash/backend/sql/gnc-book-sql.cpp
+++ b/libgnucash/backend/sql/gnc-book-sql.cpp
@@ -27,8 +27,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include "qof.h"
@@ -40,7 +38,6 @@ extern "C"
 #if defined( S_SPLINT_S )
 #include "splint-defs.h"
 #endif
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-budget-sql.cpp b/libgnucash/backend/sql/gnc-budget-sql.cpp
index 67ecb3a9b..492eefb3d 100644
--- a/libgnucash/backend/sql/gnc-budget-sql.cpp
+++ b/libgnucash/backend/sql/gnc-budget-sql.cpp
@@ -26,8 +26,6 @@
  * restoring data to/from an SQL db
  */
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib.h>
@@ -39,7 +37,6 @@ extern "C"
 #if defined( S_SPLINT_S )
 #include "splint-defs.h"
 #endif
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-commodity-sql.cpp b/libgnucash/backend/sql/gnc-commodity-sql.cpp
index 32689d323..e3383dbe9 100644
--- a/libgnucash/backend/sql/gnc-commodity-sql.cpp
+++ b/libgnucash/backend/sql/gnc-commodity-sql.cpp
@@ -26,15 +26,12 @@
  * restoring data to/from an SQL db
  */
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib.h>
 
 #include "qof.h"
 #include "gnc-commodity.h"
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-customer-sql.cpp b/libgnucash/backend/sql/gnc-customer-sql.cpp
index 26e075ca9..82a141d0f 100644
--- a/libgnucash/backend/sql/gnc-customer-sql.cpp
+++ b/libgnucash/backend/sql/gnc-customer-sql.cpp
@@ -29,8 +29,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <stdlib.h>
@@ -39,7 +37,6 @@ extern "C"
 #include "gncBillTermP.h"
 #include "gncCustomerP.h"
 #include "gncTaxTableP.h"
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-employee-sql.cpp b/libgnucash/backend/sql/gnc-employee-sql.cpp
index b0cb6e3d1..a84218a9d 100644
--- a/libgnucash/backend/sql/gnc-employee-sql.cpp
+++ b/libgnucash/backend/sql/gnc-employee-sql.cpp
@@ -29,8 +29,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <stdlib.h>
@@ -38,7 +36,6 @@ extern "C"
 
 #include "gnc-commodity.h"
 #include "gncEmployeeP.h"
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-entry-sql.cpp b/libgnucash/backend/sql/gnc-entry-sql.cpp
index 053996bc6..9df5fb8d2 100644
--- a/libgnucash/backend/sql/gnc-entry-sql.cpp
+++ b/libgnucash/backend/sql/gnc-entry-sql.cpp
@@ -29,8 +29,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <stdlib.h>
@@ -40,7 +38,6 @@ extern "C"
 #include "gncOrderP.h"
 #include "gncInvoiceP.h"
 #include "gncTaxTableP.h"
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-invoice-sql.cpp b/libgnucash/backend/sql/gnc-invoice-sql.cpp
index adfbebaf5..4f2551b6f 100644
--- a/libgnucash/backend/sql/gnc-invoice-sql.cpp
+++ b/libgnucash/backend/sql/gnc-invoice-sql.cpp
@@ -28,8 +28,6 @@
  * restoring data to/from an SQL database
  */
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib.h>
@@ -40,7 +38,6 @@ extern "C"
 
 #include "gncBillTermP.h"
 #include "gncInvoiceP.h"
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-job-sql.cpp b/libgnucash/backend/sql/gnc-job-sql.cpp
index 5daf2bdd8..beb8b9e1c 100644
--- a/libgnucash/backend/sql/gnc-job-sql.cpp
+++ b/libgnucash/backend/sql/gnc-job-sql.cpp
@@ -29,15 +29,12 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <stdlib.h>
 #include <string.h>
 
 #include "gncJobP.h"
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-lots-sql.cpp b/libgnucash/backend/sql/gnc-lots-sql.cpp
index 322ff8526..6fd27944c 100644
--- a/libgnucash/backend/sql/gnc-lots-sql.cpp
+++ b/libgnucash/backend/sql/gnc-lots-sql.cpp
@@ -27,8 +27,6 @@
  */
 
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib.h>
@@ -40,7 +38,6 @@ extern "C"
 #if defined( S_SPLINT_S )
 #include "splint-defs.h"
 #endif
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-order-sql.cpp b/libgnucash/backend/sql/gnc-order-sql.cpp
index e339e027a..3201bf983 100644
--- a/libgnucash/backend/sql/gnc-order-sql.cpp
+++ b/libgnucash/backend/sql/gnc-order-sql.cpp
@@ -29,15 +29,12 @@
  */
 
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib.h>
 #include <stdlib.h>
 #include <string.h>
 #include "gncOrderP.h"
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-owner-sql.cpp b/libgnucash/backend/sql/gnc-owner-sql.cpp
index c25e00b26..2cbf09c09 100644
--- a/libgnucash/backend/sql/gnc-owner-sql.cpp
+++ b/libgnucash/backend/sql/gnc-owner-sql.cpp
@@ -28,8 +28,6 @@
  * restoring data to/from an SQL database
  */
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 #include <qof.h>
 #include <glib.h>
@@ -37,7 +35,6 @@ extern "C"
 #include "gncJobP.h"
 #include "gncEmployeeP.h"
 #include "gncVendorP.h"
-}
 #include <cstdlib>
 #include <cstring>
 #include <sstream>
diff --git a/libgnucash/backend/sql/gnc-price-sql.cpp b/libgnucash/backend/sql/gnc-price-sql.cpp
index 9dd5e60ae..57e2b14dc 100644
--- a/libgnucash/backend/sql/gnc-price-sql.cpp
+++ b/libgnucash/backend/sql/gnc-price-sql.cpp
@@ -27,8 +27,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include "qof.h"
@@ -37,7 +35,6 @@ extern "C"
 #if defined( S_SPLINT_S )
 #include "splint-defs.h"
 #endif
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-recurrence-sql.cpp b/libgnucash/backend/sql/gnc-recurrence-sql.cpp
index fb82c90ec..0789d3f63 100644
--- a/libgnucash/backend/sql/gnc-recurrence-sql.cpp
+++ b/libgnucash/backend/sql/gnc-recurrence-sql.cpp
@@ -27,8 +27,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include "qof.h"
@@ -38,7 +36,6 @@ extern "C"
 #if defined( S_SPLINT_S )
 #include "splint-defs.h"
 #endif
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-schedxaction-sql.cpp b/libgnucash/backend/sql/gnc-schedxaction-sql.cpp
index dddaf83f1..735f9b11c 100644
--- a/libgnucash/backend/sql/gnc-schedxaction-sql.cpp
+++ b/libgnucash/backend/sql/gnc-schedxaction-sql.cpp
@@ -27,8 +27,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include "qof.h"
@@ -39,7 +37,6 @@ extern "C"
 #ifdef S_SPLINT_S
 #include "splint-defs.h"
 #endif
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/gnc-slots-sql.cpp b/libgnucash/backend/sql/gnc-slots-sql.cpp
index 4d197345e..19abcfb6d 100644
--- a/libgnucash/backend/sql/gnc-slots-sql.cpp
+++ b/libgnucash/backend/sql/gnc-slots-sql.cpp
@@ -26,8 +26,6 @@
  * restoring data to/from an SQL db
  */
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib.h>
@@ -38,7 +36,6 @@ extern "C"
 #ifdef S_SPLINT_S
 #include "splint-defs.h"
 #endif
-}
 
 #include <string>
 #include <sstream>
diff --git a/libgnucash/backend/sql/gnc-sql-backend.cpp b/libgnucash/backend/sql/gnc-sql-backend.cpp
index 082e3403b..9ca69b8a6 100644
--- a/libgnucash/backend/sql/gnc-sql-backend.cpp
+++ b/libgnucash/backend/sql/gnc-sql-backend.cpp
@@ -20,8 +20,6 @@
  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 \********************************************************************/
-extern "C"
-{
 #include <config.h>
 #include <gnc-prefs.h>
 #include <gnc-engine.h>
@@ -32,7 +30,6 @@ extern "C"
 #include <gncTaxTable.h>
 #include <gncInvoice.h>
 #include <gnc-pricedb.h>
-}
 
 #include <algorithm>
 #include <cassert>
diff --git a/libgnucash/backend/sql/gnc-sql-backend.hpp b/libgnucash/backend/sql/gnc-sql-backend.hpp
index cbdfdaf93..ec7bf705d 100644
--- a/libgnucash/backend/sql/gnc-sql-backend.hpp
+++ b/libgnucash/backend/sql/gnc-sql-backend.hpp
@@ -24,11 +24,9 @@
 #ifndef __GNC_SQL_BACKEND_HPP__
 #define __GNC_SQL_BACKEND_HPP__
 
-extern "C"
-{
 #include <qof.h>
 #include <Account.h>
-}
+
 #include <memory>
 #include <exception>
 #include <sstream>
diff --git a/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp b/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
index 1c300066a..f76b26b6e 100644
--- a/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
+++ b/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
@@ -21,11 +21,8 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 \********************************************************************/
 
-extern "C"
-{
 #include <config.h>
 #include <qof.h>
-}
 #include <sstream>
 #include <iomanip>
 #include <gnc-datetime.hpp>
diff --git a/libgnucash/backend/sql/gnc-sql-column-table-entry.hpp b/libgnucash/backend/sql/gnc-sql-column-table-entry.hpp
index 926029a38..ae9c9b90c 100644
--- a/libgnucash/backend/sql/gnc-sql-column-table-entry.hpp
+++ b/libgnucash/backend/sql/gnc-sql-column-table-entry.hpp
@@ -24,10 +24,7 @@
 #ifndef __GNC_SQL_COLUMN_TABLE_ENTRY_HPP__
 #define __GNC_SQL_COLUMN_TABLE_ENTRY_HPP__
 
-extern "C"
-{
 #include <qof.h>
-}
 #include <memory>
 #include <vector>
 #include <iostream>
diff --git a/libgnucash/backend/sql/gnc-sql-connection.hpp b/libgnucash/backend/sql/gnc-sql-connection.hpp
index eeef88603..4f2fd1121 100644
--- a/libgnucash/backend/sql/gnc-sql-connection.hpp
+++ b/libgnucash/backend/sql/gnc-sql-connection.hpp
@@ -24,10 +24,7 @@
 #ifndef __GNC_SQL_CONNECTION_HPP__
 #define __GNC_SQL_CONNECTION_HPP__
 
-extern "C"
-{
 #include <qof.h>
-}
 #include <memory>
 #include <string>
 #include <vector>
diff --git a/libgnucash/backend/sql/gnc-sql-object-backend.cpp b/libgnucash/backend/sql/gnc-sql-object-backend.cpp
index dbaeaeda6..428f49ded 100644
--- a/libgnucash/backend/sql/gnc-sql-object-backend.cpp
+++ b/libgnucash/backend/sql/gnc-sql-object-backend.cpp
@@ -21,10 +21,7 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                      *
 \***********************************************************************/
 
-extern "C"
-{
 #include <config.h>
-}
 #include "gnc-sql-object-backend.hpp"
 #include "gnc-sql-backend.hpp"
 #include "gnc-sql-column-table-entry.hpp"
diff --git a/libgnucash/backend/sql/gnc-sql-object-backend.hpp b/libgnucash/backend/sql/gnc-sql-object-backend.hpp
index bd3f70512..5a8a90194 100644
--- a/libgnucash/backend/sql/gnc-sql-object-backend.hpp
+++ b/libgnucash/backend/sql/gnc-sql-object-backend.hpp
@@ -24,10 +24,8 @@
 #ifndef __GNC_SQL_OBJECT_BACKEND_HPP__
 #define __GNC_SQL_OBJECT_BACKEND_HPP__
 
-extern "C"
-{
 #include <qof.h>
-}
+
 #include <memory>
 #include <string>
 #include <vector>
diff --git a/libgnucash/backend/sql/gnc-sql-result.cpp b/libgnucash/backend/sql/gnc-sql-result.cpp
index 20f774b68..9b7b5ddfb 100644
--- a/libgnucash/backend/sql/gnc-sql-result.cpp
+++ b/libgnucash/backend/sql/gnc-sql-result.cpp
@@ -21,10 +21,7 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                      *
 \***********************************************************************/
 
-extern "C"
-{
 #include <config.h>
-}
 #include <sstream>
 #include "gnc-sql-column-table-entry.hpp"
 
diff --git a/libgnucash/backend/sql/gnc-sql-result.hpp b/libgnucash/backend/sql/gnc-sql-result.hpp
index 3c5c558a9..757084c3b 100644
--- a/libgnucash/backend/sql/gnc-sql-result.hpp
+++ b/libgnucash/backend/sql/gnc-sql-result.hpp
@@ -24,10 +24,8 @@
 #ifndef __GNC_SQL_RESULT_HPP__
 #define __GNC_SQL_RESULT_HPP__
 
-extern "C"
-{
 #include <qof.h>
-}
+
 #include <cstdint>
 #include <string>
 #include <vector>
diff --git a/libgnucash/backend/sql/gnc-tax-table-sql.cpp b/libgnucash/backend/sql/gnc-tax-table-sql.cpp
index 818ab84ed..4a30a9069 100644
--- a/libgnucash/backend/sql/gnc-tax-table-sql.cpp
+++ b/libgnucash/backend/sql/gnc-tax-table-sql.cpp
@@ -28,8 +28,6 @@
  * restoring data to/from an SQL database
  */
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib.h>
@@ -38,7 +36,6 @@ extern "C"
 
 #include "gncEntry.h"
 #include "gncTaxTableP.h"
-}
 
 #include <string>
 #include <vector>
diff --git a/libgnucash/backend/sql/gnc-transaction-sql.cpp b/libgnucash/backend/sql/gnc-transaction-sql.cpp
index 05ad24b7d..d5e877842 100644
--- a/libgnucash/backend/sql/gnc-transaction-sql.cpp
+++ b/libgnucash/backend/sql/gnc-transaction-sql.cpp
@@ -26,8 +26,6 @@
  * restoring data to/from an SQL db
  */
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <glib/gi18n.h>
@@ -47,7 +45,6 @@ extern "C"
 #ifdef S_SPLINT_S
 #include "splint-defs.h"
 #endif
-}
 
 #include <string>
 #include <sstream>
diff --git a/libgnucash/backend/sql/gnc-vendor-sql.cpp b/libgnucash/backend/sql/gnc-vendor-sql.cpp
index 481b1f422..0ad17b4f5 100644
--- a/libgnucash/backend/sql/gnc-vendor-sql.cpp
+++ b/libgnucash/backend/sql/gnc-vendor-sql.cpp
@@ -29,8 +29,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
@@ -39,7 +37,6 @@ extern "C"
 #include "gncBillTermP.h"
 #include "gncVendorP.h"
 #include "gncTaxTableP.h"
-}
 
 #include "gnc-sql-connection.hpp"
 #include "gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/sql/test/test-column-types.cpp b/libgnucash/backend/sql/test/test-column-types.cpp
index 5e2c17038..d3aa6e549 100644
--- a/libgnucash/backend/sql/test/test-column-types.cpp
+++ b/libgnucash/backend/sql/test/test-column-types.cpp
@@ -23,16 +23,10 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  *  02110-1301, USA.
  */
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
-}
-extern "C"
-{
 #include "cashobjects.h"
 #include "test-stuff.h"
-}
 
 int main (int argc, char** argv)
 {
diff --git a/libgnucash/backend/sql/test/test-sqlbe.cpp b/libgnucash/backend/sql/test/test-sqlbe.cpp
index 0a6191c3f..5141e7a90 100644
--- a/libgnucash/backend/sql/test/test-sqlbe.cpp
+++ b/libgnucash/backend/sql/test/test-sqlbe.cpp
@@ -22,11 +22,8 @@
 
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
-}
 extern void test_suite_gnc_backend_sql ();
 
 int
diff --git a/libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp b/libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp
index f7e639ae0..0136d0993 100644
--- a/libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp
+++ b/libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp
@@ -22,12 +22,9 @@
 ********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include <unittest-support.h>
-}
 /* Add specific headers for this class */
 #include "../gnc-sql-connection.hpp"
 #include "../gnc-sql-backend.hpp"
diff --git a/libgnucash/backend/xml/gnc-account-xml-v2.cpp b/libgnucash/backend/xml/gnc-account-xml-v2.cpp
index cfc8b3213..95f54ab5b 100644
--- a/libgnucash/backend/xml/gnc-account-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-account-xml-v2.cpp
@@ -24,14 +24,11 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include <AccountP.h>
 #include <Account.h>
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-address-xml-v2.cpp b/libgnucash/backend/xml/gnc-address-xml-v2.cpp
index bd0a1a807..5e5481593 100644
--- a/libgnucash/backend/xml/gnc-address-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-address-xml-v2.cpp
@@ -23,12 +23,9 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
-}
 
 #include "gnc-xml-helper.h"
 
diff --git a/libgnucash/backend/xml/gnc-address-xml-v2.h b/libgnucash/backend/xml/gnc-address-xml-v2.h
index d1ed84f4a..ed26a5ab6 100644
--- a/libgnucash/backend/xml/gnc-address-xml-v2.h
+++ b/libgnucash/backend/xml/gnc-address-xml-v2.h
@@ -22,10 +22,9 @@
 
 #ifndef GNC_ADDRESS_XML_V2_H
 #define GNC_ADDRESS_XML_V2_H
-extern "C"
-{
+
 #include "gncAddress.h"
-}
+
 gboolean   gnc_dom_tree_to_address (xmlNodePtr node, GncAddress* address);
 xmlNodePtr gnc_address_to_dom_tree (const char* tag, GncAddress* addr);
 void gnc_address_xml_initialize (void);
diff --git a/libgnucash/backend/xml/gnc-backend-xml.cpp b/libgnucash/backend/xml/gnc-backend-xml.cpp
index c0a51a925..8a941b28b 100644
--- a/libgnucash/backend/xml/gnc-backend-xml.cpp
+++ b/libgnucash/backend/xml/gnc-backend-xml.cpp
@@ -31,8 +31,6 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 
 
@@ -75,7 +73,6 @@ extern "C"
 #ifndef HAVE_STRPTIME
 # include "strptime.h"
 #endif
-}
 
 #include <gnc-backend-prov.hpp>
 #include "gnc-backend-xml.h"
diff --git a/libgnucash/backend/xml/gnc-bill-term-xml-v2.cpp b/libgnucash/backend/xml/gnc-bill-term-xml-v2.cpp
index 06c6799f2..278813f13 100644
--- a/libgnucash/backend/xml/gnc-bill-term-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-bill-term-xml-v2.cpp
@@ -21,8 +21,6 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  *                                                                  *
 \********************************************************************/
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
@@ -30,7 +28,6 @@ extern "C"
 #include "gncBillTermP.h"
 #include "gncInvoice.h"
 #include "qof.h"
-}
 
 #include "gnc-xml-helper.h"
 
diff --git a/libgnucash/backend/xml/gnc-book-xml-v2.cpp b/libgnucash/backend/xml/gnc-book-xml-v2.cpp
index 17d0b53ba..17740c1f3 100644
--- a/libgnucash/backend/xml/gnc-book-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-book-xml-v2.cpp
@@ -24,13 +24,10 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include "qof.h"
-}
 
 #include "gnc-xml-helper.h"
 
diff --git a/libgnucash/backend/xml/gnc-budget-xml-v2.cpp b/libgnucash/backend/xml/gnc-budget-xml-v2.cpp
index 80ed55748..cab10a82f 100644
--- a/libgnucash/backend/xml/gnc-budget-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-budget-xml-v2.cpp
@@ -22,12 +22,9 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp b/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp
index ea12cdaad..25503d9ad 100644
--- a/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp
@@ -23,13 +23,10 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include "AccountP.h"
 #include "Account.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-customer-xml-v2.cpp b/libgnucash/backend/xml/gnc-customer-xml-v2.cpp
index bf2edd91e..05ee5fa4c 100644
--- a/libgnucash/backend/xml/gnc-customer-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-customer-xml-v2.cpp
@@ -23,8 +23,6 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
@@ -32,7 +30,6 @@ extern "C"
 #include "gncBillTermP.h"
 #include "gncCustomerP.h"
 #include "gncTaxTableP.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "gnc-customer-xml-v2.h"
diff --git a/libgnucash/backend/xml/gnc-employee-xml-v2.cpp b/libgnucash/backend/xml/gnc-employee-xml-v2.cpp
index f70bab19a..37b72ddde 100644
--- a/libgnucash/backend/xml/gnc-employee-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-employee-xml-v2.cpp
@@ -23,13 +23,10 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include "gncEmployeeP.h"
-}
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
 #include "sixtp-utils.h"
diff --git a/libgnucash/backend/xml/gnc-entry-xml-v2.cpp b/libgnucash/backend/xml/gnc-entry-xml-v2.cpp
index 08125df99..55bbd6442 100644
--- a/libgnucash/backend/xml/gnc-entry-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-entry-xml-v2.cpp
@@ -23,8 +23,6 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
@@ -33,7 +31,6 @@ extern "C"
 #include "gncOrderP.h"
 #include "gncInvoiceP.h"
 #include "gncTaxTableP.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp b/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp
index bc75540b0..b266adedc 100644
--- a/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp
@@ -24,14 +24,11 @@
 
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include "qof.h"
 #include "SchedXaction.h"
 #include "FreqSpec.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-invoice-xml-v2.cpp b/libgnucash/backend/xml/gnc-invoice-xml-v2.cpp
index 6cbc3aa6e..904204b77 100644
--- a/libgnucash/backend/xml/gnc-invoice-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-invoice-xml-v2.cpp
@@ -23,15 +23,12 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "gncBillTermP.h"
 #include "gncInvoiceP.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-job-xml-v2.cpp b/libgnucash/backend/xml/gnc-job-xml-v2.cpp
index 39e70e7a3..50d639937 100644
--- a/libgnucash/backend/xml/gnc-job-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-job-xml-v2.cpp
@@ -23,13 +23,10 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include "gncJobP.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-lot-xml-v2.cpp b/libgnucash/backend/xml/gnc-lot-xml-v2.cpp
index 2041b5f72..1f287e270 100644
--- a/libgnucash/backend/xml/gnc-lot-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-lot-xml-v2.cpp
@@ -24,14 +24,11 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include "gnc-lot.h"
 #include "gnc-lot-p.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-order-xml-v2.cpp b/libgnucash/backend/xml/gnc-order-xml-v2.cpp
index 9d54f530d..4160f2f42 100644
--- a/libgnucash/backend/xml/gnc-order-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-order-xml-v2.cpp
@@ -23,13 +23,10 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include "gncOrderP.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-owner-xml-v2.cpp b/libgnucash/backend/xml/gnc-owner-xml-v2.cpp
index 159f48d5e..a28ff6398 100644
--- a/libgnucash/backend/xml/gnc-owner-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-owner-xml-v2.cpp
@@ -23,8 +23,6 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
@@ -32,7 +30,6 @@ extern "C"
 #include "gncJobP.h"
 #include "gncVendorP.h"
 #include "gncEmployeeP.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp b/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp
index be9b99afb..55ffeba12 100644
--- a/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp
@@ -20,14 +20,11 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  *                                                                  *
  *******************************************************************/
-extern "C"
-{
 #include <config.h>
 
 #include <string.h>
 #include "gnc-pricedb.h"
 #include "gnc-pricedb-p.h"
-}
 
 #include "gnc-xml.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp b/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp
index cab44edc1..7ffb68e31 100644
--- a/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp
@@ -22,13 +22,10 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include "qof.h"
 #include "Recurrence.h"
-}
 
 #include "gnc-xml.h"
 #include "gnc-xml-helper.h"
diff --git a/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp b/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
index 4ef67f06e..57eba9002 100644
--- a/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
@@ -22,13 +22,10 @@
  *******************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 
 #include "SX-book.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-tax-table-xml-v2.cpp b/libgnucash/backend/xml/gnc-tax-table-xml-v2.cpp
index a8c714a03..8186d75fa 100644
--- a/libgnucash/backend/xml/gnc-tax-table-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-tax-table-xml-v2.cpp
@@ -23,14 +23,11 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include "gncEntry.h"
 #include "gncTaxTableP.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp b/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
index bf095e09e..7d078e977 100644
--- a/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
@@ -23,8 +23,6 @@
  *******************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include "AccountP.h"
@@ -32,7 +30,6 @@ extern "C"
 #include "TransactionP.h"
 #include "gnc-lot.h"
 #include "gnc-lot-p.h"
-}
 
 #include "gnc-xml-helper.h"
 
diff --git a/libgnucash/backend/xml/gnc-vendor-xml-v2.cpp b/libgnucash/backend/xml/gnc-vendor-xml-v2.cpp
index 520cdd3d3..03fc094c2 100644
--- a/libgnucash/backend/xml/gnc-vendor-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-vendor-xml-v2.cpp
@@ -23,15 +23,12 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include "gncBillTermP.h"
 #include "gncVendorP.h"
 #include "gncTaxTableP.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/gnc-xml-backend.cpp b/libgnucash/backend/xml/gnc-xml-backend.cpp
index 03cc9b9b0..bc7136a86 100644
--- a/libgnucash/backend/xml/gnc-xml-backend.cpp
+++ b/libgnucash/backend/xml/gnc-xml-backend.cpp
@@ -17,8 +17,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 #include <platform.h>
 #if PLATFORM(WINDOWS)
@@ -36,8 +34,6 @@ extern "C"
 #include <TransLog.h>
 #include <gnc-prefs.h>
 
-}
-
 #include <sstream>
 
 #include "gnc-xml-backend.hpp"
diff --git a/libgnucash/backend/xml/gnc-xml-backend.hpp b/libgnucash/backend/xml/gnc-xml-backend.hpp
index 662ec8e41..e125764b6 100644
--- a/libgnucash/backend/xml/gnc-xml-backend.hpp
+++ b/libgnucash/backend/xml/gnc-xml-backend.hpp
@@ -18,10 +18,7 @@
 #ifndef __GNC_XML_BACKEND_HPP__
 #define __GNC_XML_BACKEND_HPP__
 
-extern "C"
-{
 #include <qof.h>
-}
 
 #include <string>
 #include <qof-backend.hpp>
diff --git a/libgnucash/backend/xml/io-example-account.cpp b/libgnucash/backend/xml/io-example-account.cpp
index dd6831ec5..1d8913718 100644
--- a/libgnucash/backend/xml/io-example-account.cpp
+++ b/libgnucash/backend/xml/io-example-account.cpp
@@ -25,8 +25,6 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <platform.h>
@@ -52,7 +50,6 @@ extern "C"
 #if COMPILER(MSVC)
 # define g_fopen fopen
 #endif
-}
 
 #include "sixtp.h"
 
diff --git a/libgnucash/backend/xml/io-gncxml-gen.cpp b/libgnucash/backend/xml/io-gncxml-gen.cpp
index 4585662fc..b9a395c6b 100644
--- a/libgnucash/backend/xml/io-gncxml-gen.cpp
+++ b/libgnucash/backend/xml/io-gncxml-gen.cpp
@@ -21,10 +21,7 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  *                                                                  *
 \********************************************************************/
-extern "C"
-{
 #include <config.h>
-}
 
 #include "io-gncxml-gen.h"
 
diff --git a/libgnucash/backend/xml/io-gncxml-v1.cpp b/libgnucash/backend/xml/io-gncxml-v1.cpp
index a731b421a..821ab8ed4 100644
--- a/libgnucash/backend/xml/io-gncxml-v1.cpp
+++ b/libgnucash/backend/xml/io-gncxml-v1.cpp
@@ -25,8 +25,6 @@
  *                                                                  *
  *******************************************************************/
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <stdlib.h>
@@ -44,7 +42,6 @@ extern "C"
 #include <TransLog.h>
 #include <gnc-pricedb.h>
 #include <gnc-pricedb-p.h>
-}
 
 #include "io-gncxml.h"
 #include "sixtp.h"
diff --git a/libgnucash/backend/xml/io-gncxml-v2.cpp b/libgnucash/backend/xml/io-gncxml-v2.cpp
index 9b746fdfe..94e6e2fbb 100644
--- a/libgnucash/backend/xml/io-gncxml-v2.cpp
+++ b/libgnucash/backend/xml/io-gncxml-v2.cpp
@@ -21,8 +21,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <platform.h>
@@ -65,7 +63,6 @@ extern "C"
 # define g_fopen fopen
 # define g_open _open
 #endif
-}
 
 #include "gnc-xml-backend.hpp"
 #include "sixtp-parsers.h"
diff --git a/libgnucash/backend/xml/io-utils.cpp b/libgnucash/backend/xml/io-utils.cpp
index c203fb677..29ad18065 100644
--- a/libgnucash/backend/xml/io-utils.cpp
+++ b/libgnucash/backend/xml/io-utils.cpp
@@ -23,12 +23,9 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <stdio.h>
-}
 
 #include "gnc-xml.h"
 #include "io-utils.h"
diff --git a/libgnucash/backend/xml/sixtp-dom-generators.cpp b/libgnucash/backend/xml/sixtp-dom-generators.cpp
index 94e5b9d18..715a0d91f 100644
--- a/libgnucash/backend/xml/sixtp-dom-generators.cpp
+++ b/libgnucash/backend/xml/sixtp-dom-generators.cpp
@@ -22,14 +22,11 @@
  ********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #define __EXTENSIONS__
 
 #include <config.h>
 
 #include <gnc-date.h>
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp-dom-generators.h"
diff --git a/libgnucash/backend/xml/sixtp-dom-parsers.cpp b/libgnucash/backend/xml/sixtp-dom-parsers.cpp
index 5d33afe19..2b693ca3e 100644
--- a/libgnucash/backend/xml/sixtp-dom-parsers.cpp
+++ b/libgnucash/backend/xml/sixtp-dom-parsers.cpp
@@ -22,14 +22,11 @@
  ********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <string.h>
 
 #include <gnc-engine.h>
-}
 
 #include "gnc-xml-helper.h"
 #include "sixtp-utils.h"
diff --git a/libgnucash/backend/xml/sixtp-stack.cpp b/libgnucash/backend/xml/sixtp-stack.cpp
index 36bbc4a6e..7cd7597c6 100644
--- a/libgnucash/backend/xml/sixtp-stack.cpp
+++ b/libgnucash/backend/xml/sixtp-stack.cpp
@@ -20,10 +20,7 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  *                                                                  *
  ********************************************************************/
-extern "C"
-{
 #include <config.h>
-}
 #include "sixtp.h"
 #include "sixtp-stack.h"
 
diff --git a/libgnucash/backend/xml/sixtp-to-dom-parser.cpp b/libgnucash/backend/xml/sixtp-to-dom-parser.cpp
index 277a6f867..7578bc381 100644
--- a/libgnucash/backend/xml/sixtp-to-dom-parser.cpp
+++ b/libgnucash/backend/xml/sixtp-to-dom-parser.cpp
@@ -20,11 +20,8 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  *                                                                  *
  ********************************************************************/
-extern "C"
-{
 #include <config.h>
 #include <ctype.h>
-}
 
 #include <glib.h>
 
diff --git a/libgnucash/backend/xml/sixtp-utils.cpp b/libgnucash/backend/xml/sixtp-utils.cpp
index 9faadbe67..3da4b1f12 100644
--- a/libgnucash/backend/xml/sixtp-utils.cpp
+++ b/libgnucash/backend/xml/sixtp-utils.cpp
@@ -23,8 +23,6 @@
 
 #define __EXTENSIONS__
 #include <guid.hpp>
-extern "C"
-{
 #include <config.h>
 
 #include <ctype.h>
@@ -40,7 +38,6 @@ extern "C"
 #include "strptime.h"
 #endif
 #include <gnc-date.h>
-}
 
 #include "sixtp.h"
 #include "sixtp-utils.h"
diff --git a/libgnucash/backend/xml/sixtp.cpp b/libgnucash/backend/xml/sixtp.cpp
index cc82f2092..199d8258b 100644
--- a/libgnucash/backend/xml/sixtp.cpp
+++ b/libgnucash/backend/xml/sixtp.cpp
@@ -23,8 +23,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include <ctype.h>
@@ -36,7 +34,6 @@ extern "C"
     typedef int ssize_t;
 # define g_fopen fopen
 #endif
-}
 
 #include "sixtp.h"
 #include "sixtp-parsers.h"
diff --git a/libgnucash/backend/xml/test/test-dom-converters1.cpp b/libgnucash/backend/xml/test/test-dom-converters1.cpp
index 02c31dfe6..2e70ab980 100644
--- a/libgnucash/backend/xml/test/test-dom-converters1.cpp
+++ b/libgnucash/backend/xml/test/test-dom-converters1.cpp
@@ -23,8 +23,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <string.h>
@@ -33,7 +31,6 @@ extern "C"
 #include "cashobjects.h"
 #include "gnc-engine.h"
 #include "gnc-commodity.h"
-}
 
 #include <cstdlib>
 
diff --git a/libgnucash/backend/xml/test/test-file-stuff.cpp b/libgnucash/backend/xml/test/test-file-stuff.cpp
index 0264c8122..da5f14151 100644
--- a/libgnucash/backend/xml/test/test-file-stuff.cpp
+++ b/libgnucash/backend/xml/test/test-file-stuff.cpp
@@ -24,8 +24,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <unistd.h>
@@ -37,7 +35,6 @@ extern "C"
 
 #include "gnc-engine.h"
 #include "test-stuff.h"
-}
 
 #include <cstdlib>
 
diff --git a/libgnucash/backend/xml/test/test-kvp-frames.cpp b/libgnucash/backend/xml/test/test-kvp-frames.cpp
index 508d60020..eca84dda9 100644
--- a/libgnucash/backend/xml/test/test-kvp-frames.cpp
+++ b/libgnucash/backend/xml/test/test-kvp-frames.cpp
@@ -1,7 +1,5 @@
 #include <kvp-frame.hpp>
 
-extern "C"
-{
 #include <config.h>
 
 #include <stdlib.h>
@@ -10,7 +8,6 @@ extern "C"
 #include "test-engine-stuff.h"
 
 #include "qof.h"
-}
 
 #include "test-file-stuff.h"
 #include "sixtp-dom-generators.h"
diff --git a/libgnucash/backend/xml/test/test-load-backend.cpp b/libgnucash/backend/xml/test/test-load-backend.cpp
index 65d540636..0cf924a5b 100644
--- a/libgnucash/backend/xml/test/test-load-backend.cpp
+++ b/libgnucash/backend/xml/test/test-load-backend.cpp
@@ -24,13 +24,10 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  *  02110-1301, USA.
  */
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
 #include "cashobjects.h"
 #include "test-stuff.h"
-}
 
 #define GNC_LIB_NAME "gncmod-backend-xml"
 #define GNC_LIB_REL_PATH "xml"
diff --git a/libgnucash/backend/xml/test/test-load-example-account.cpp b/libgnucash/backend/xml/test/test-load-example-account.cpp
index 3596a7cad..c8fdf3248 100644
--- a/libgnucash/backend/xml/test/test-load-example-account.cpp
+++ b/libgnucash/backend/xml/test/test-load-example-account.cpp
@@ -22,8 +22,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include <stdio.h>
@@ -34,7 +32,6 @@ extern "C"
 
 #include "gnc-engine.h"
 #include "test-engine-stuff.h"
-}
 
 #include <cstdlib>
 
diff --git a/libgnucash/backend/xml/test/test-load-xml2.cpp b/libgnucash/backend/xml/test/test-load-xml2.cpp
index 5325b2948..ef6ecc4c9 100644
--- a/libgnucash/backend/xml/test/test-load-xml2.cpp
+++ b/libgnucash/backend/xml/test/test-load-xml2.cpp
@@ -29,8 +29,6 @@
 #include <glib-object.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <sys/types.h>
@@ -48,7 +46,6 @@ extern "C"
 
 #include <unittest-support.h>
 #include <test-engine-stuff.h>
-}
 
 #include "../gnc-backend-xml.h"
 #include "../io-gncxml-v2.h"
diff --git a/libgnucash/backend/xml/test/test-string-converters.cpp b/libgnucash/backend/xml/test/test-string-converters.cpp
index 72f74ba21..22509aad0 100644
--- a/libgnucash/backend/xml/test/test-string-converters.cpp
+++ b/libgnucash/backend/xml/test/test-string-converters.cpp
@@ -17,15 +17,12 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  *                                                                  *
 \********************************************************************/
-extern "C"
-{
 #include <config.h>
 
 #include <stdlib.h>
 #include "gnc-engine.h"
 
 #include "test-engine-stuff.h"
-}
 
 #include "test-file-stuff.h"
 #include "sixtp-dom-parsers.h"
diff --git a/libgnucash/backend/xml/test/test-xml-account.cpp b/libgnucash/backend/xml/test/test-xml-account.cpp
index ee90e5901..bc5d541fe 100644
--- a/libgnucash/backend/xml/test/test-xml-account.cpp
+++ b/libgnucash/backend/xml/test/test-xml-account.cpp
@@ -24,8 +24,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <unistd.h>
@@ -37,7 +35,6 @@ extern "C"
 
 #include "Account.h"
 #include "Scrub.h"
-}
 
 #include <cstdlib>
 
diff --git a/libgnucash/backend/xml/test/test-xml-commodity.cpp b/libgnucash/backend/xml/test/test-xml-commodity.cpp
index 5deeeed9d..58683a75e 100644
--- a/libgnucash/backend/xml/test/test-xml-commodity.cpp
+++ b/libgnucash/backend/xml/test/test-xml-commodity.cpp
@@ -20,8 +20,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <unistd.h>
@@ -30,7 +28,6 @@ extern "C"
 #include "test-engine-stuff.h"
 
 #include "Account.h"
-}
 
 #include <cstdlib>
 
diff --git a/libgnucash/backend/xml/test/test-xml-pricedb.cpp b/libgnucash/backend/xml/test/test-xml-pricedb.cpp
index b5a734cc0..0b625b7e5 100644
--- a/libgnucash/backend/xml/test/test-xml-pricedb.cpp
+++ b/libgnucash/backend/xml/test/test-xml-pricedb.cpp
@@ -24,8 +24,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <stdlib.h>
@@ -36,7 +34,6 @@ extern "C"
 #include "gnc-pricedb.h"
 
 #include "test-engine-stuff.h"
-}
 
 #include "gnc-xml-helper.h"
 #include "gnc-xml.h"
diff --git a/libgnucash/backend/xml/test/test-xml-transaction.cpp b/libgnucash/backend/xml/test/test-xml-transaction.cpp
index 54a22262a..4eddc6598 100644
--- a/libgnucash/backend/xml/test/test-xml-transaction.cpp
+++ b/libgnucash/backend/xml/test/test-xml-transaction.cpp
@@ -24,8 +24,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <stdlib.h>
@@ -45,7 +43,6 @@ extern "C"
 #include <AccountP.h>
 #include <Transaction.h>
 #include <TransactionP.h>
-}
 
 #include "../gnc-xml-helper.h"
 #include "../gnc-xml.h"
diff --git a/libgnucash/backend/xml/test/test-xml2-is-file.cpp b/libgnucash/backend/xml/test/test-xml2-is-file.cpp
index 82ff4526d..6303313f0 100644
--- a/libgnucash/backend/xml/test/test-xml2-is-file.cpp
+++ b/libgnucash/backend/xml/test/test-xml2-is-file.cpp
@@ -17,12 +17,9 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  *                                                                  *
 \********************************************************************/
-extern "C"
-{
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
-}
 
 #include "test-engine-stuff.h"
 #include "io-gncxml-v2.h"
diff --git a/libgnucash/core-utils/gnc-environment.h b/libgnucash/core-utils/gnc-environment.h
index 44372a277..a095e229e 100644
--- a/libgnucash/core-utils/gnc-environment.h
+++ b/libgnucash/core-utils/gnc-environment.h
@@ -46,12 +46,20 @@
 #ifndef GNC_ENVIRONMENT_H
 #define GNC_ENVIRONMENT_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Parse <prefix>/etc/gnucash/environment and set environment variables
  *  based on the contents of that file. Read the comments in
  *  <prefix>/etc/gnucash/environment for more details.
  */
 void gnc_environment_setup (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_ENVIRONMENT_H */
 
 /** @} */
diff --git a/libgnucash/core-utils/gnc-filepath-utils.cpp b/libgnucash/core-utils/gnc-filepath-utils.cpp
index d65038a2f..0123069b6 100644
--- a/libgnucash/core-utils/gnc-filepath-utils.cpp
+++ b/libgnucash/core-utils/gnc-filepath-utils.cpp
@@ -31,7 +31,6 @@
 #include <glib/gprintf.h>
 #include <glib/gstdio.h>
 
-extern "C" {
 #include <config.h>
 
 #include <platform.h>
@@ -63,7 +62,6 @@ extern "C" {
 #ifdef MAC_INTEGRATION
 #include <Foundation/Foundation.h>
 #endif
-}
 
 #include "gnc-locale-utils.hpp"
 #include <boost/filesystem.hpp>
diff --git a/libgnucash/core-utils/gnc-filepath-utils.h b/libgnucash/core-utils/gnc-filepath-utils.h
index 57e1ddf77..1f5ca8bae 100644
--- a/libgnucash/core-utils/gnc-filepath-utils.h
+++ b/libgnucash/core-utils/gnc-filepath-utils.h
@@ -29,6 +29,10 @@
 #ifndef GNC_FILEPATH_UTILS_H
 #define GNC_FILEPATH_UTILS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** The gnc_resolve_file_path() routine is a utility that will accept
  *    a fragmentary filename as input, and resolve it into a fully
  *    qualified path in the file system, i.e. a path that begins with
@@ -190,4 +194,8 @@ typedef struct
  */
 GList *gnc_list_all_paths (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_FILEPATH_UTILS_H */
diff --git a/libgnucash/core-utils/gnc-path.h b/libgnucash/core-utils/gnc-path.h
index cc133e921..fba6aae60 100644
--- a/libgnucash/core-utils/gnc-path.h
+++ b/libgnucash/core-utils/gnc-path.h
@@ -25,6 +25,10 @@
 
 #include <glib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Returns the installation prefix path, usually
  * "$prefix".
  *
@@ -118,5 +122,8 @@ gchar *gnc_path_get_reportsdir(void);
 gchar *gnc_path_get_stdreportsdir(void);
 
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* GNC_PATH_H */
diff --git a/libgnucash/core-utils/gnc-prefs.h b/libgnucash/core-utils/gnc-prefs.h
index 7d7a104d0..5010bfc95 100644
--- a/libgnucash/core-utils/gnc-prefs.h
+++ b/libgnucash/core-utils/gnc-prefs.h
@@ -45,11 +45,7 @@
 #ifndef GNC_PREFS_H
 #define GNC_PREFS_H
 
-#ifdef __cplusplus
-extern "C++" {
 #include <glib.h>
-}
-#endif
 
 /* Preference groups used across multiple modules */
 #define GNC_PREFS_GROUP_GENERAL           "general"
@@ -97,6 +93,10 @@ extern "C++" {
 #define GNC_PREF_CURRENCY_CHOICE_LOCALE "currency-choice-locale"
 #define GNC_PREF_CURRENCY_CHOICE_OTHER  "currency-choice-other"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @name Early bird functions, needed before any backend has been set up
  @{
 */
@@ -569,6 +569,10 @@ void gnc_prefs_set_reg_negative_color_pref_id (gulong id);
 
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif /* GNC_PREFS_H */
 
diff --git a/libgnucash/core-utils/gnc-version.h b/libgnucash/core-utils/gnc-version.h
index f3d6fee90..47e8b2bfc 100644
--- a/libgnucash/core-utils/gnc-version.h
+++ b/libgnucash/core-utils/gnc-version.h
@@ -44,12 +44,20 @@
  *  <prefix>/etc/gnucash/environment for more details.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 const char *gnc_version(void);
 const char *gnc_build_id(void);
 const char *gnc_vcs_rev(void);
 const char *gnc_vcs_rev_date(void);
 const int gnc_gnucash_major_version(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_VERSION_H */
 
 /** @} */
diff --git a/libgnucash/core-utils/test/gtest-path-utilities.cpp b/libgnucash/core-utils/test/gtest-path-utilities.cpp
index 90e1240ee..14792dfca 100644
--- a/libgnucash/core-utils/test/gtest-path-utilities.cpp
+++ b/libgnucash/core-utils/test/gtest-path-utilities.cpp
@@ -1,13 +1,10 @@
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <gncla-dir.h>
 #include <gnc-path.h>
 #include <binreloc.h>
 #include <gnc-filepath-utils.h>
-}
 
 #include <gtest/gtest.h>
 
diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp
index b0fc10f6b..5f293ab4b 100644
--- a/libgnucash/engine/Account.cpp
+++ b/libgnucash/engine/Account.cpp
@@ -25,9 +25,7 @@
 
 #include <config.h>
 
-extern "C" {
 #include "gnc-prefs.h"
-}
 
 #include <glib.h>
 #include <glib/gi18n.h>
diff --git a/libgnucash/engine/Query.h b/libgnucash/engine/Query.h
index b3722ae08..096e4f6af 100644
--- a/libgnucash/engine/Query.h
+++ b/libgnucash/engine/Query.h
@@ -30,6 +30,10 @@
 #include "qof.h"
 #include "Account.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * This function defines a compatibility API from the old Query API to
  * the new Query API.  Note that it is not a 100% complete equivalent.
@@ -186,4 +190,8 @@ void xaccQueryAddGUIDMatch(QofQuery * q, const GncGUID *guid,
 time64 xaccQueryGetEarliestDateFound(QofQuery * q);
 time64 xaccQueryGetLatestDateFound(QofQuery * q);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/libgnucash/engine/Recurrence.h b/libgnucash/engine/Recurrence.h
index 6f8df001e..298cb6cba 100644
--- a/libgnucash/engine/Recurrence.h
+++ b/libgnucash/engine/Recurrence.h
@@ -44,6 +44,10 @@
 #include "Account.h"
 #include "gnc-numeric.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum
 {
     PERIOD_ONCE,         /* Not a true period at all, but convenient here. */
@@ -185,4 +189,8 @@ int recurrenceListCmp(GList *a, GList *b);
 
 void recurrenceListFree(GList **recurrence);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif  /* RECURRENCE_H */
diff --git a/libgnucash/engine/SX-book-p.h b/libgnucash/engine/SX-book-p.h
index 4513811c0..3339cd4ee 100644
--- a/libgnucash/engine/SX-book-p.h
+++ b/libgnucash/engine/SX-book-p.h
@@ -39,6 +39,10 @@
 
 /* ====================================================================== */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 SchedXactions* gnc_collection_get_schedxactions(const QofCollection *col);
 
 /* Associate the given template root account with a book */
@@ -46,4 +50,8 @@ void gnc_book_set_template_root (QofBook *book, Account *templateRoot);
 
 gboolean gnc_sxtt_register (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_SX_BOOK_P_H */
diff --git a/libgnucash/engine/SX-book.h b/libgnucash/engine/SX-book.h
index 111aaceaf..82b9e2c85 100644
--- a/libgnucash/engine/SX-book.h
+++ b/libgnucash/engine/SX-book.h
@@ -42,14 +42,15 @@
 typedef struct xaccSchedXactionsDef SchedXactions;
 typedef struct _SchedXactionsClass SchedXactionsClass;
 
-#ifdef __cplusplus
-extern "C++" {
 #include <glib.h>
-}
-#endif
+
 #include "SchedXaction.h"
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct xaccSchedXactionsDef
 {
     QofInstance inst;
@@ -91,6 +92,10 @@ Account *gnc_book_get_template_root(const QofBook *book);
 /** @return The list of SXes which reference the given Account. Caller should free this list. **/
 GList* gnc_sx_get_sxes_referencing_account(QofBook *book, Account *acct);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_SX_BOOK_H */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/SX-ttinfo.h b/libgnucash/engine/SX-ttinfo.h
index 72486f7a6..1c36d1d3e 100644
--- a/libgnucash/engine/SX-ttinfo.h
+++ b/libgnucash/engine/SX-ttinfo.h
@@ -31,6 +31,10 @@
 #include "Account.h"
 #include "gnc-commodity.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct TTInfo_s TTInfo;
 typedef struct TTSplitInfo_s TTSplitInfo;
 
@@ -87,4 +91,8 @@ const char *gnc_ttsplitinfo_get_debit_formula(TTSplitInfo *split_i);
 void gnc_ttsplitinfo_set_account(TTSplitInfo *split_i, Account *acc);
 Account *gnc_ttsplitinfo_get_account(TTSplitInfo *split_i);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/libgnucash/engine/SchedXaction.h b/libgnucash/engine/SchedXaction.h
index 4fa22d459..e58b6d204 100644
--- a/libgnucash/engine/SchedXaction.h
+++ b/libgnucash/engine/SchedXaction.h
@@ -44,6 +44,10 @@ typedef struct _SchedXactionClass SchedXactionClass;
 #include "Recurrence.h"
 #include "gnc-engine.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* --- type macros --- */
 #define GNC_TYPE_SCHEDXACTION            (gnc_schedxaction_get_type ())
 #define GNC_SCHEDXACTION(o)              \
@@ -322,6 +326,10 @@ gboolean SXRegister (void);
 /** \deprecated */
 #define xaccSchedXactionGetGUID(X) qof_entity_get_guid(QOF_INSTANCE(X))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* XACC_SCHEDXACTION_H */
 
 /** @} */
diff --git a/libgnucash/engine/Scrub.h b/libgnucash/engine/Scrub.h
index 34ec0e598..ddfca07eb 100644
--- a/libgnucash/engine/Scrub.h
+++ b/libgnucash/engine/Scrub.h
@@ -52,6 +52,10 @@
 
 #include "gnc-engine.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @name Double-Entry Scrubbing
     Convert single-entry accounts to clean double-entry
 
@@ -170,6 +174,10 @@ void xaccAccountScrubColorNotSet (QofBook *book);
  */
 void xaccTransScrubPostedDate (Transaction *trans);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* XACC_SCRUB_H */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/Scrub3.h b/libgnucash/engine/Scrub3.h
index 2c1a8eae7..43501801d 100644
--- a/libgnucash/engine/Scrub3.h
+++ b/libgnucash/engine/Scrub3.h
@@ -34,6 +34,10 @@
 
 #include "gnc-engine.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @name High-Level Lot Constraint
  * Provides the high-level API for checking and repairing ('scrubbing
  * clean') the usage of Lots and Cap Gains transactions in stock and
@@ -70,6 +74,11 @@ void xaccAccountScrubLots (Account *acc);
 void xaccAccountTreeScrubLots (Account *acc);
 
 /** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* XACC_SCRUB3_H */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/SplitP.h b/libgnucash/engine/SplitP.h
index 4192cc5dd..93cfe8312 100644
--- a/libgnucash/engine/SplitP.h
+++ b/libgnucash/engine/SplitP.h
@@ -52,6 +52,10 @@
 #include "qof.h"
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** STRUCTS *********************************************************/
 /* A "split" is more commonly referred to as an "entry" in a "transaction".
  */
@@ -232,6 +236,10 @@ typedef struct
 
 SplitTestFunctions* _utest_split_fill_functions (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 
 /*@}*/
 
diff --git a/libgnucash/engine/TransLog.h b/libgnucash/engine/TransLog.h
index 502171b85..9f1ba8fd6 100644
--- a/libgnucash/engine/TransLog.h
+++ b/libgnucash/engine/TransLog.h
@@ -46,6 +46,10 @@
 #include "Account.h"
 #include "Transaction.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void    xaccOpenLog (void);
 void    xaccCloseLog (void);
 void    xaccReopenLog (void);
@@ -81,6 +85,10 @@ void    xaccLogSetBaseName (const char *);
 /** Test a filename to see if it is the name of the current logfile */
 gboolean xaccFileIsCurrentLog (const gchar *name);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* XACC_TRANS_LOG_H */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/TransactionP.h b/libgnucash/engine/TransactionP.h
index 3e107ff39..e90b45fc8 100644
--- a/libgnucash/engine/TransactionP.h
+++ b/libgnucash/engine/TransactionP.h
@@ -52,6 +52,10 @@
 #include "SplitP.h"
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 /** STRUCTS *********************************************************/
 /*
@@ -205,5 +209,9 @@ TransTestFunctions* _utest_trans_fill_functions (void);
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif /* XACC_TRANSACTION_P_H */
diff --git a/libgnucash/engine/cashobjects.h b/libgnucash/engine/cashobjects.h
index 42dfd2be7..b6759517d 100644
--- a/libgnucash/engine/cashobjects.h
+++ b/libgnucash/engine/cashobjects.h
@@ -30,6 +30,14 @@
 
 #include <glib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 gboolean cashobjects_register(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _CASHOBJECTS_H */
diff --git a/libgnucash/engine/engine-helpers.h b/libgnucash/engine/engine-helpers.h
index 29a504ce9..57900484e 100644
--- a/libgnucash/engine/engine-helpers.h
+++ b/libgnucash/engine/engine-helpers.h
@@ -25,17 +25,17 @@
 #ifndef ENGINE_HELPERS_H
 #define ENGINE_HELPERS_H
 
-#ifdef __cplusplus
-extern "C++" {
 #include <glib.h>
-}
-#endif
 
 #include "gnc-engine.h"
 #include "Account.h"
 #include "Query.h"
 #include "Transaction.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef void (*GncBOCb)    (gpointer new_val, gpointer user_data);
 
 /** Gets the transaction Number or split Action based on book option:
@@ -83,4 +83,8 @@ gnc_book_option_register_cb (gchar *key, GncBOCb func, gpointer user_data);
 void
 gnc_book_option_remove_cb (gchar *key, GncBOCb func, gpointer user_data);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/libgnucash/engine/gnc-accounting-period.h b/libgnucash/engine/gnc-accounting-period.h
index 835d03b9c..80997ffcf 100644
--- a/libgnucash/engine/gnc-accounting-period.h
+++ b/libgnucash/engine/gnc-accounting-period.h
@@ -47,6 +47,10 @@
 #include <glib.h>
 #include <gnc-date.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * This specifies a time interval.
  */
@@ -125,6 +129,10 @@ time64 gnc_accounting_period_fiscal_end (void);
 
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_ACCOUNTING_PERIOD_H */
 
 /** @} */
diff --git a/libgnucash/engine/gnc-aqbanking-templates.cpp b/libgnucash/engine/gnc-aqbanking-templates.cpp
index b8a7c7a4a..27cb5cdf1 100644
--- a/libgnucash/engine/gnc-aqbanking-templates.cpp
+++ b/libgnucash/engine/gnc-aqbanking-templates.cpp
@@ -27,10 +27,7 @@
 
 #include <string>
 
-extern "C"
-{
 #include "gnc-aqbanking-templates.h"
-}
 
 #include "qofinstance-p.h"
 #include "kvp-frame.hpp"
diff --git a/libgnucash/engine/gnc-commodity.h b/libgnucash/engine/gnc-commodity.h
index cafc331e7..75d0bc693 100644
--- a/libgnucash/engine/gnc-commodity.h
+++ b/libgnucash/engine/gnc-commodity.h
@@ -49,12 +49,8 @@
 typedef struct _GncCommodityClass gnc_commodityClass;
 typedef struct _GncCommodityNamespaceClass gnc_commodity_namespaceClass;
 
-#ifdef __cplusplus
-extern "C++" {
 #include <glib.h>
 #include <glib/gi18n.h>
-}
-#endif
 
 #include "gnc-engine.h"
 
diff --git a/libgnucash/engine/gnc-commodity.hpp b/libgnucash/engine/gnc-commodity.hpp
index d4590c62c..b1e0c53cc 100644
--- a/libgnucash/engine/gnc-commodity.hpp
+++ b/libgnucash/engine/gnc-commodity.hpp
@@ -35,9 +35,7 @@
 
 #include <vector>
 
-extern "C" {
 #include <gnc-commodity.h>
-}
 
 using CommVec = std::vector<gnc_commodity*>;
 
diff --git a/libgnucash/engine/gnc-date.cpp b/libgnucash/engine/gnc-date.cpp
index 326a72a3b..ba3c5c84c 100644
--- a/libgnucash/engine/gnc-date.cpp
+++ b/libgnucash/engine/gnc-date.cpp
@@ -27,8 +27,6 @@
 
 #define __EXTENSIONS__
 #include <glib.h>
-extern "C"
-{
 
 #include <config.h>
 #include <libintl.h>
@@ -45,7 +43,6 @@ extern "C"
 #ifdef G_OS_WIN32
 #  include <windows.h>
 #endif
-}
 
 #include <cinttypes>
 #include <unicode/calendar.h>
diff --git a/libgnucash/engine/gnc-date.h b/libgnucash/engine/gnc-date.h
index d2da7be27..0b06af4a8 100644
--- a/libgnucash/engine/gnc-date.h
+++ b/libgnucash/engine/gnc-date.h
@@ -69,21 +69,15 @@
 #ifndef GNC_DATE_H
 #define GNC_DATE_H
 
+#include <glib-object.h>
+
+#include <time.h>
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
-#ifdef __cplusplus
-extern "C++" {
-#endif
-#include <glib-object.h>
-#ifdef __cplusplus
-}
-#endif
- 
-#include <time.h>
 
 /**
  * Many systems, including Microsoft Windows and BSD-derived Unixes
diff --git a/libgnucash/engine/gnc-datetime.cpp b/libgnucash/engine/gnc-datetime.cpp
index d030f8e09..62764b672 100644
--- a/libgnucash/engine/gnc-datetime.cpp
+++ b/libgnucash/engine/gnc-datetime.cpp
@@ -22,11 +22,8 @@
  *                                                                  *
 \********************************************************************/
 
-extern "C"
-{
 #include <config.h>
 #include "platform.h"
-}
 #include <boost/date_time/gregorian/gregorian.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/date_time/local_time/local_time.hpp>
diff --git a/libgnucash/engine/gnc-engine.h b/libgnucash/engine/gnc-engine.h
index c3693a600..9a981c8e5 100644
--- a/libgnucash/engine/gnc-engine.h
+++ b/libgnucash/engine/gnc-engine.h
@@ -36,11 +36,7 @@
 #ifndef GNC_ENGINE_H
 #define GNC_ENGINE_H
 
-#ifdef __cplusplus
-extern "C++" {
 #include <glib.h>
-}
-#endif
 
 #include "qof.h"
 
diff --git a/libgnucash/engine/gnc-euro.h b/libgnucash/engine/gnc-euro.h
index 13f47bbf2..93c9c69e9 100644
--- a/libgnucash/engine/gnc-euro.h
+++ b/libgnucash/engine/gnc-euro.h
@@ -27,6 +27,10 @@
 #include "gnc-commodity.h"
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 gboolean    gnc_is_euro_currency (const gnc_commodity * currency);
 gnc_numeric gnc_convert_to_euro (const gnc_commodity * currency,
                                  gnc_numeric value);
@@ -36,4 +40,8 @@ gnc_numeric gnc_euro_currency_get_rate (const gnc_commodity *currency);
 
 gnc_commodity * gnc_get_euro (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif  /* EURO_UTILS_H */
diff --git a/libgnucash/engine/gnc-features.cpp b/libgnucash/engine/gnc-features.cpp
index edb62f8a5..79bfea18c 100644
--- a/libgnucash/engine/gnc-features.cpp
+++ b/libgnucash/engine/gnc-features.cpp
@@ -29,10 +29,7 @@
 #include <glib/gi18n.h>
 #include "qofbook.hpp"
 
-extern "C"
-{
 #include "gnc-features.h"
-}
 
 static const FeaturesTable features_table
 {
diff --git a/libgnucash/engine/gnc-hooks.h b/libgnucash/engine/gnc-hooks.h
index efbddd44a..63fc902d6 100644
--- a/libgnucash/engine/gnc-hooks.h
+++ b/libgnucash/engine/gnc-hooks.h
@@ -25,6 +25,10 @@
 #ifndef GNC_HOOKS_H
 #define GNC_HOOKS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Create a new hook.  Not a common occurrence, but...
  * The returned string is just the 'name' argument,
@@ -73,4 +77,8 @@ void gnc_hooks_init(void);
 #define HOOK_BOOK_CLOSED	"hook_book_closed"
 #define HOOK_BOOK_SAVED		"hook_book_saved"
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_HOOKS_H */
diff --git a/libgnucash/engine/gnc-int128.cpp b/libgnucash/engine/gnc-int128.cpp
index 8ec77f5ce..d670232ab 100644
--- a/libgnucash/engine/gnc-int128.cpp
+++ b/libgnucash/engine/gnc-int128.cpp
@@ -21,10 +21,7 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  *                                                                  *
  *******************************************************************/
-extern "C"
-{
 #include <config.h>
-}
 
 #include "gnc-int128.hpp"
 
diff --git a/libgnucash/engine/gnc-int128.hpp b/libgnucash/engine/gnc-int128.hpp
index db463fad8..a352f73eb 100644
--- a/libgnucash/engine/gnc-int128.hpp
+++ b/libgnucash/engine/gnc-int128.hpp
@@ -25,8 +25,6 @@
 #ifndef GNCINT128_H
 #define GNCINT128_H
 
-extern "C"
-{
 #ifndef __STDC_LIMIT_MACROS
 #define  __STDC_LIMIT_MACROS 1
 #endif
@@ -37,7 +35,6 @@ extern "C"
 #define  __STDC_FORMAT_MACROS 1
 #endif
 #include <inttypes.h>
-}
 
 #include <stdexcept>
 #include <string>
diff --git a/libgnucash/engine/gnc-numeric.cpp b/libgnucash/engine/gnc-numeric.cpp
index 40a57464c..a33519855 100644
--- a/libgnucash/engine/gnc-numeric.cpp
+++ b/libgnucash/engine/gnc-numeric.cpp
@@ -33,11 +33,8 @@
 #include <boost/regex.hpp>
 #include <boost/locale/encoding_utf.hpp>
 
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
-}
 
 #include "gnc-numeric.hpp"
 #include "gnc-rational.hpp"
diff --git a/libgnucash/engine/gnc-numeric.h b/libgnucash/engine/gnc-numeric.h
index 64b0bc625..254d18ca9 100644
--- a/libgnucash/engine/gnc-numeric.h
+++ b/libgnucash/engine/gnc-numeric.h
@@ -49,13 +49,14 @@ See \ref gncnumericexample
 
 #ifndef GNC_NUMERIC_H
 #define GNC_NUMERIC_H
+
+#include <glib-object.h>
+
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
-#include <glib-object.h>
-
 struct _gnc_numeric
 {
     gint64  num;
diff --git a/libgnucash/engine/gnc-option-date.cpp b/libgnucash/engine/gnc-option-date.cpp
index 023ab4f6c..918ca3ba5 100644
--- a/libgnucash/engine/gnc-option-date.cpp
+++ b/libgnucash/engine/gnc-option-date.cpp
@@ -27,10 +27,7 @@
 #include <cassert>
 #include <algorithm>
 
-extern "C"
-{
 #include "gnc-accounting-period.h"
-}
 
 #define N_(string) string //So that xgettext will find it
 
diff --git a/libgnucash/engine/gnc-option-date.hpp b/libgnucash/engine/gnc-option-date.hpp
index c7da74dad..98dc0fac0 100644
--- a/libgnucash/engine/gnc-option-date.hpp
+++ b/libgnucash/engine/gnc-option-date.hpp
@@ -31,10 +31,7 @@
 #ifndef GNC_OPTION_DATE_HPP_
 #define GNC_OPTION_DATE_HPP_
 
-extern "C"
-{
 #include "gnc-date.h"
-}
 
 #include <vector>
 #include <iostream>
diff --git a/libgnucash/engine/gnc-option-impl.cpp b/libgnucash/engine/gnc-option-impl.cpp
index 0dd2813e2..80f7c5aed 100644
--- a/libgnucash/engine/gnc-option-impl.cpp
+++ b/libgnucash/engine/gnc-option-impl.cpp
@@ -29,12 +29,9 @@
 #include <sstream>
 #include <numeric>
 
-extern "C"
-{
 #include "gnc-accounting-period.h"
 #include "gnc-session.h"
 #include "gncOwner.h"
-}
 
 static const QofLogModule log_module{"gnc.options"};
 
diff --git a/libgnucash/engine/gnc-option-impl.hpp b/libgnucash/engine/gnc-option-impl.hpp
index c72b63bed..c145a430c 100644
--- a/libgnucash/engine/gnc-option-impl.hpp
+++ b/libgnucash/engine/gnc-option-impl.hpp
@@ -34,14 +34,12 @@
 #define GNC_OPTION_IMPL_HPP_
 
 #include "gnc-option.hpp"
-extern "C"
-{
+
 #include <config.h>
 #include "qof.h"
 #include "Account.h"
 #include "gnc-budget.h"
 #include "gnc-commodity.h"
-}
 #include "gnc-datetime.hpp"
 #include <string>
 #include <utility>
diff --git a/libgnucash/engine/gnc-option.cpp b/libgnucash/engine/gnc-option.cpp
index 0e2392d35..277491645 100644
--- a/libgnucash/engine/gnc-option.cpp
+++ b/libgnucash/engine/gnc-option.cpp
@@ -28,10 +28,7 @@
 
 static const char* log_module{"gnc.app-utils.gnc-option"};
 
-extern "C"
-{
 #include "qoflog.h"
-}
 
 template <typename ValueType,
           typename std::enable_if_t<!is_OptionClassifier_v<ValueType>,
diff --git a/libgnucash/engine/gnc-option.hpp b/libgnucash/engine/gnc-option.hpp
index 8df1a1ca6..828ebaae2 100644
--- a/libgnucash/engine/gnc-option.hpp
+++ b/libgnucash/engine/gnc-option.hpp
@@ -50,9 +50,9 @@ using GncOptionUIItemPtr = std::unique_ptr<GncOptionUIItem>;
 #ifndef SWIG //SWIG pulls in GncOwner from swig-engine.
 struct _gncOwner;
 using GncOwner = _gncOwner;
-#endif
 struct _QofQuery;
 using QofQuery = _QofQuery;
+#endif
 struct QofInstance_s;
 using QofInstance = QofInstance_s;
 template <typename ValueType> class GncOptionValue;
diff --git a/libgnucash/engine/gnc-optiondb-impl.hpp b/libgnucash/engine/gnc-optiondb-impl.hpp
index 75c7a82d8..f6dbc169b 100644
--- a/libgnucash/engine/gnc-optiondb-impl.hpp
+++ b/libgnucash/engine/gnc-optiondb-impl.hpp
@@ -39,8 +39,7 @@
 #include <exception>
 #include <optional>
 #include <iostream>
-extern "C"
-{
+
 #include <config.h>
 #include "qof.h"
 #include "gncInvoice.h"
@@ -49,7 +48,6 @@ extern "C"
 #include "gncJob.h"
 #include "gncVendor.h"
 #include "gncTaxTable.h"
-}
 
 using GncOptionVec = std::vector<GncOption>;
 
diff --git a/libgnucash/engine/gnc-optiondb.cpp b/libgnucash/engine/gnc-optiondb.cpp
index d3e7f9416..594d19777 100644
--- a/libgnucash/engine/gnc-optiondb.cpp
+++ b/libgnucash/engine/gnc-optiondb.cpp
@@ -33,10 +33,7 @@
 #include "gnc-optiondb-impl.hpp"
 #include "gnc-option-ui.hpp"
 
-extern "C"
-{
 #include "gnc-session.h"
-}
 constexpr const char* log_module{G_LOG_DOMAIN};
 
 constexpr auto stream_max = std::numeric_limits<std::streamsize>::max();
diff --git a/libgnucash/engine/gnc-optiondb.h b/libgnucash/engine/gnc-optiondb.h
index a3aa3686d..61ad9afc5 100644
--- a/libgnucash/engine/gnc-optiondb.h
+++ b/libgnucash/engine/gnc-optiondb.h
@@ -63,10 +63,6 @@ typedef struct GncOption GncOption;
 typedef struct GncOptionDB GncOptionDB;
 #endif
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 #include <config.h>
 #include "Account.h"
 #include "gnc-budget.h"
@@ -74,6 +70,11 @@ extern "C"
 #include "gncInvoice.h"
 #include "gncTaxTable.h"
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /**
  * Create an empty option database.
  *
diff --git a/libgnucash/engine/gnc-optiondb.hpp b/libgnucash/engine/gnc-optiondb.hpp
index 58f550351..7147001f3 100644
--- a/libgnucash/engine/gnc-optiondb.hpp
+++ b/libgnucash/engine/gnc-optiondb.hpp
@@ -38,15 +38,13 @@
 #include <exception>
 #include <optional>
 #include <iostream>
-extern "C"
-{
+
 #include <config.h>
 #include "Account.h"
 #include "gnc-budget.h"
 #include "gnc-commodity.h"
 #include "gncInvoice.h"
 #include "gncTaxTable.h"
-}
 #include "gnc-option.hpp"
 #include "gnc-datetime.hpp"
 
diff --git a/libgnucash/engine/gnc-pricedb-p.h b/libgnucash/engine/gnc-pricedb-p.h
index 49eaefc92..d1cfc343a 100644
--- a/libgnucash/engine/gnc-pricedb-p.h
+++ b/libgnucash/engine/gnc-pricedb-p.h
@@ -30,6 +30,10 @@
 #include "gnc-engine.h"
 #include "gnc-pricedb.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct gnc_price_s
 {
     /* 'public' data fields */
@@ -96,4 +100,8 @@ gboolean gnc_pricedb_register (void);
 
 QofBackend * xaccPriceDBGetBackend (GNCPriceDB *prdb);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/libgnucash/engine/gnc-session.h b/libgnucash/engine/gnc-session.h
index fc89e1709..86aa27c8e 100644
--- a/libgnucash/engine/gnc-session.h
+++ b/libgnucash/engine/gnc-session.h
@@ -21,7 +21,15 @@
 
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 QofSession * gnc_get_current_session (void);
 void gnc_clear_current_session(void);
 void gnc_set_current_session (QofSession *session);
 gboolean gnc_current_session_exist(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/libgnucash/engine/gnc-timezone.cpp b/libgnucash/engine/gnc-timezone.cpp
index 06aedb297..c5ef090a2 100644
--- a/libgnucash/engine/gnc-timezone.cpp
+++ b/libgnucash/engine/gnc-timezone.cpp
@@ -31,11 +31,8 @@
 //We'd prefer to use std::codecvt, but it's not supported by gcc until 5.0.
 #include <boost/locale/encoding_utf.hpp>
 #endif
-extern "C"
-{
 #include "qoflog.h"
 static const QofLogModule log_module = "gnc-timezone";
-}
 
 using namespace gnc::date;
 
diff --git a/libgnucash/engine/gnc-timezone.hpp b/libgnucash/engine/gnc-timezone.hpp
index c533cfdd6..97254af15 100644
--- a/libgnucash/engine/gnc-timezone.hpp
+++ b/libgnucash/engine/gnc-timezone.hpp
@@ -22,13 +22,11 @@
 
 #ifndef __GNC_TIMEZONE_HPP__
 #define __GNC_TIMEZONE_HPP__
-extern "C"
-{
+
 #include <platform.h>
 #if PLATFORM(WINDOWS)
 #include <windows.h>
 #endif
-}
 
 #define BOOST_ERROR_CODE_HEADER_ONLY
 #include <boost/date_time/local_time/local_time.hpp>
diff --git a/libgnucash/engine/gnc-uri-utils.h b/libgnucash/engine/gnc-uri-utils.h
index cd3c1ad09..492c048dd 100644
--- a/libgnucash/engine/gnc-uri-utils.h
+++ b/libgnucash/engine/gnc-uri-utils.h
@@ -63,6 +63,10 @@
 
 #include "platform.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Checks if the given uri is a valid uri
  *
  *  A valid uri is defined by having at least a scheme and a path.
@@ -310,6 +314,10 @@ gboolean gnc_uri_is_file_protocol (const gchar *protocol)
 
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNCURIUTILS_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncAddress.h b/libgnucash/engine/gncAddress.h
index 1473130ce..34db15eeb 100644
--- a/libgnucash/engine/gncAddress.h
+++ b/libgnucash/engine/gncAddress.h
@@ -57,6 +57,10 @@ up to you to pass a suitable entity.
 #include "qof.h"
 #include "gncBusiness.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_ADDRESS_MODULE_NAME        "gncAddress"
 #define GNC_ID_ADDRESS GNC_ADDRESS_MODULE_NAME
 /** \struct GncAddress
@@ -152,6 +156,10 @@ gboolean gncAddressEqual(const GncAddress *a, const GncAddress *b);
 #define ADDRESS_EMAIL   "email"
 #define ADDRESS_OWNER   "owner"
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_ADDRESS_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncBillTerm.h b/libgnucash/engine/gncBillTerm.h
index 724679cc7..a9b431434 100644
--- a/libgnucash/engine/gncBillTerm.h
+++ b/libgnucash/engine/gncBillTerm.h
@@ -37,6 +37,10 @@ typedef struct _gncBillTermClass GncBillTermClass;
 #include "qof.h"
 #include "gncBusiness.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_ID_BILLTERM       "gncBillTerm"
 
 /* --- type macros --- */
@@ -168,6 +172,10 @@ time64 gncBillTermComputeDueDate (const GncBillTerm *term, time64 post_date);
 /* deprecated */
 #define gncBillTermGetGUID(x) qof_instance_get_guid (QOF_INSTANCE(x))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_BILLTERM_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncBillTermP.h b/libgnucash/engine/gncBillTermP.h
index 7cd456e8a..16444ab31 100644
--- a/libgnucash/engine/gncBillTermP.h
+++ b/libgnucash/engine/gncBillTermP.h
@@ -31,6 +31,10 @@
 
 #include "gncBillTerm.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 gboolean gncBillTermRegister (void);
 
 void gncBillTermSetParent (GncBillTerm *term, GncBillTerm *parent);
@@ -42,5 +46,9 @@ gboolean gncBillTermGetInvisible (const GncBillTerm *term);
 
 #define gncBillTermSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
 
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif /* GNC_BILLTERMP_H_ */
diff --git a/libgnucash/engine/gncBusiness.h b/libgnucash/engine/gncBusiness.h
index 6fd23f2ed..2fe054d1d 100644
--- a/libgnucash/engine/gncBusiness.h
+++ b/libgnucash/engine/gncBusiness.h
@@ -34,11 +34,8 @@
 #ifndef GNC_BUSINESS_H_
 #define GNC_BUSINESS_H_
 
-#ifdef __cplusplus
-extern "C++" {
 #include <glib.h>
-}
-#endif
+
 #include "qof.h"
 #include "Account.h"
 
diff --git a/libgnucash/engine/gncCustomer.h b/libgnucash/engine/gncCustomer.h
index 58ca70b1d..d569310ff 100644
--- a/libgnucash/engine/gncCustomer.h
+++ b/libgnucash/engine/gncCustomer.h
@@ -31,6 +31,10 @@
 #ifndef GNC_CUSTOMER_H_
 #define GNC_CUSTOMER_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @struct GncCustomer
 
 credit, discount and shipaddr are unique to GncCustomer\n
@@ -164,6 +168,11 @@ gboolean gncCustomerEqual(const GncCustomer *a, const GncCustomer *b);
 GList * gncCustomerGetJoblist (const GncCustomer *customer, gboolean show_all);
 gboolean gncCustomerIsDirty (GncCustomer *customer);
 
+#ifdef __cplusplus
+}
+#endif
+
+
 #endif /* GNC_CUSTOMER_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncEmployee.h b/libgnucash/engine/gncEmployee.h
index 901123b62..0b49fdbf6 100644
--- a/libgnucash/engine/gncEmployee.h
+++ b/libgnucash/engine/gncEmployee.h
@@ -31,6 +31,10 @@
 #ifndef GNC_EMPLOYEE_H_
 #define GNC_EMPLOYEE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct _gncEmployee GncEmployee;
 typedef struct _gncEmployeeClass GncEmployeeClass;
 
@@ -137,6 +141,10 @@ static inline GncEmployee * gncEmployeeLookup (const QofBook *book, const GncGUI
 gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2);
 gboolean gncEmployeeIsDirty (const GncEmployee *employee);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_EMPLOYEE_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncEntry.h b/libgnucash/engine/gncEntry.h
index bdb4c1212..a6cad1870 100644
--- a/libgnucash/engine/gncEntry.h
+++ b/libgnucash/engine/gncEntry.h
@@ -31,10 +31,10 @@
 #ifndef GNC_ENTRY_H_
 #define GNC_ENTRY_H_
 
-#ifdef __cplusplus
-extern "C++" {
 #include <glib.h>
-}
+
+#ifdef __cplusplus
+extern "C" {
 #endif
 
 typedef struct _gncEntry GncEntry;
@@ -335,6 +335,10 @@ int gncEntryCompare (const GncEntry *a, const GncEntry *b);
 /* deprecated functions, should be removed */
 #define gncEntryGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_ENTRY_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncEntryP.h b/libgnucash/engine/gncEntryP.h
index f34787439..5a776453e 100644
--- a/libgnucash/engine/gncEntryP.h
+++ b/libgnucash/engine/gncEntryP.h
@@ -31,6 +31,10 @@
 
 #include "gncEntry.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 gboolean gncEntryRegister (void);
 void gncEntrySetGUID (GncEntry *entry, const GncGUID *guid);
 void gncEntrySetOrder (GncEntry *entry, GncOrder *order);
@@ -40,4 +44,8 @@ void gncEntrySetDirty (GncEntry *entry, gboolean dirty);
 
 #define gncEntrySetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_ENTRYP_H_ */
diff --git a/libgnucash/engine/gncInvoice.h b/libgnucash/engine/gncInvoice.h
index 43cb1865b..d9b7de9b9 100644
--- a/libgnucash/engine/gncInvoice.h
+++ b/libgnucash/engine/gncInvoice.h
@@ -36,6 +36,10 @@ transaction and lot for the posted invoice.
 #ifndef GNC_INVOICE_H_
 #define GNC_INVOICE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct _gncInvoice;
 typedef struct _gncInvoice GncInvoice;
 typedef struct _gncInvoiceClass GncInvoiceClass;
@@ -316,6 +320,10 @@ QofBook *gncInvoiceGetBook (GncInvoice *x);
 /** Test support function used by test-dbi-business-stuff.c */
 gboolean gncInvoiceEqual (const GncInvoice *a, const GncInvoice *b);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_INVOICE_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncInvoiceP.h b/libgnucash/engine/gncInvoiceP.h
index e4ad64103..db8c5a259 100644
--- a/libgnucash/engine/gncInvoiceP.h
+++ b/libgnucash/engine/gncInvoiceP.h
@@ -34,6 +34,10 @@
 #include "gnc-lot.h"
 #include "gncOwner.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 gboolean gncInvoiceRegister (void);
 gchar *gncInvoiceNextID (QofBook *book, const GncOwner *owner);
 void gncInvoiceSetPostedAcc (GncInvoice *invoice, Account *acc);
@@ -46,4 +50,9 @@ void gncInvoiceDetachFromLot (GNCLot *lot);
 void gncInvoiceAttachToTxn (GncInvoice *invoice, Transaction *txn);
 
 #define gncInvoiceSetGUID(I,G) qof_instance_set_guid(QOF_INSTANCE(I),(G))
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_INVOICEP_H_ */
diff --git a/libgnucash/engine/gncJob.h b/libgnucash/engine/gncJob.h
index b40cdbcab..72efe358d 100644
--- a/libgnucash/engine/gncJob.h
+++ b/libgnucash/engine/gncJob.h
@@ -37,6 +37,10 @@ typedef struct _gncJobClass GncJobClass;
 #include "gncAddress.h"
 #include "gncOwner.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_ID_JOB "gncJob"
 
 /* --- type macros --- */
@@ -116,6 +120,10 @@ gboolean gncJobEqual(const GncJob *a, const GncJob *b);
 #define gncJobRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null()))
 #define gncJobLookupDirect(G,B) gncJobLookup((B),&(G))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_JOB_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncOrder.h b/libgnucash/engine/gncOrder.h
index 7e7796964..f58d9ca57 100644
--- a/libgnucash/engine/gncOrder.h
+++ b/libgnucash/engine/gncOrder.h
@@ -41,6 +41,10 @@ typedef struct _gncOrderClass GncOrderClass;
 #include "gncOwner.h"
 #include "qof.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define GNC_ID_ORDER "gncOrder"
 
 /* --- type macros --- */
@@ -118,6 +122,10 @@ static inline GncOrder * gncOrderLookup (const QofBook *book, const GncGUID *gui
 #define gncOrderGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
 #define gncOrderGetBook(x) qof_instance_get_book(QOF_INSTANCE(x))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_ORDER_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncOwner.h b/libgnucash/engine/gncOwner.h
index 81cfc8c09..f592f6bce 100644
--- a/libgnucash/engine/gncOwner.h
+++ b/libgnucash/engine/gncOwner.h
@@ -33,6 +33,11 @@
 #ifndef GNC_OWNER_H_
 #define GNC_OWNER_H_
 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct _gncOwner GncOwner;
 
 #define GNC_ID_OWNER   "gncOwner"
@@ -346,6 +351,10 @@ void gncOwnerBeginEdit (GncOwner *owner);
 void gncOwnerCommitEdit (GncOwner *owner);
 void gncOwnerDestroy (GncOwner *owner);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_OWNER_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncTaxTable.h b/libgnucash/engine/gncTaxTable.h
index 4ec0dafb2..2663d86e8 100644
--- a/libgnucash/engine/gncTaxTable.h
+++ b/libgnucash/engine/gncTaxTable.h
@@ -31,6 +31,10 @@
 #ifndef GNC_TAXTABLE_H_
 #define GNC_TAXTABLE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @struct GncTaxTable
 
 modtime is the internal date of the last modtime\n
@@ -206,6 +210,10 @@ void gncAccountValueDestroy (GList *list);
 #define gncTaxTableRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null()))
 #define gncTaxTableLookupDirect(G,B) gncTaxTableLookup((B), &(G))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_TAXTABLE_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/gncTaxTableP.h b/libgnucash/engine/gncTaxTableP.h
index bf0074505..edb9cdcbb 100644
--- a/libgnucash/engine/gncTaxTableP.h
+++ b/libgnucash/engine/gncTaxTableP.h
@@ -31,6 +31,10 @@
 
 #include "gncTaxTable.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 gboolean gncTaxTableRegister (void);
 
 void gncTaxTableSetParent (GncTaxTable *table, GncTaxTable *parent);
@@ -44,4 +48,8 @@ GncTaxTable* gncTaxTableEntryGetTable( const GncTaxTableEntry* entry );
 
 #define gncTaxTableSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_TAXTABLEP_H_ */
diff --git a/libgnucash/engine/gncVendor.h b/libgnucash/engine/gncVendor.h
index 3bcdf6272..2da073ea2 100644
--- a/libgnucash/engine/gncVendor.h
+++ b/libgnucash/engine/gncVendor.h
@@ -31,6 +31,10 @@
 #ifndef GNC_VENDOR_H_
 #define GNC_VENDOR_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct _gncVendor GncVendor;
 typedef struct _gncVendorClass GncVendorClass;
 
@@ -134,6 +138,11 @@ static inline GncVendor * gncVendorLookup (const QofBook *book, const GncGUID *g
 /** Test support function, used by test-dbi-business-stuff.c */
 gboolean gncVendorEqual(const GncVendor *a, const GncVendor *b);
 gboolean gncVendorIsDirty (const GncVendor *vendor);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* GNC_VENDOR_H_ */
 /** @} */
 /** @} */
diff --git a/libgnucash/engine/guid.cpp b/libgnucash/engine/guid.cpp
index c58b49ac9..9202422a9 100644
--- a/libgnucash/engine/guid.cpp
+++ b/libgnucash/engine/guid.cpp
@@ -23,8 +23,6 @@
 \********************************************************************/
 
 #include "guid.hpp"
-extern "C"
-{
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -52,7 +50,6 @@ extern "C"
 #endif
 #include "qof.h"
 
-}
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_io.hpp>
diff --git a/libgnucash/engine/guid.hpp b/libgnucash/engine/guid.hpp
index 3a79852af..ed1f460c7 100644
--- a/libgnucash/engine/guid.hpp
+++ b/libgnucash/engine/guid.hpp
@@ -24,9 +24,8 @@
 
 #include <boost/uuid/uuid.hpp>
 #include <stdexcept>
-extern "C" {
+
 #include "guid.h"
-}
 
 namespace gnc {
 struct guid_syntax_exception : public std::invalid_argument
diff --git a/libgnucash/engine/kvp-frame.cpp b/libgnucash/engine/kvp-frame.cpp
index 56be042d4..9066a8aad 100644
--- a/libgnucash/engine/kvp-frame.cpp
+++ b/libgnucash/engine/kvp-frame.cpp
@@ -21,16 +21,12 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  *                                                                  *
  ********************************************************************/
-
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
 #include <glib.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
-}
 
 #include "kvp-value.hpp"
 #include "kvp-frame.hpp"
diff --git a/libgnucash/engine/kvp-value.hpp b/libgnucash/engine/kvp-value.hpp
index f5f176870..515f69240 100644
--- a/libgnucash/engine/kvp-value.hpp
+++ b/libgnucash/engine/kvp-value.hpp
@@ -24,11 +24,8 @@
 #ifndef GNC_KVP_VALUE_TYPE
 #define GNC_KVP_VALUE_TYPE
 
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
-}
 #include <boost/version.hpp>
 #if BOOST_VERSION == 105600
 #include <boost/type_traits/is_nothrow_move_assignable.hpp>
diff --git a/libgnucash/engine/mocks/fake-qofquery.cpp b/libgnucash/engine/mocks/fake-qofquery.cpp
index a82dadebf..43542add2 100644
--- a/libgnucash/engine/mocks/fake-qofquery.cpp
+++ b/libgnucash/engine/mocks/fake-qofquery.cpp
@@ -124,8 +124,6 @@ qof_query_set_book (QofQuery *query, QofBook *book)
     ((QofFakeQuery*)query)->set_book(book);
 }
 
-extern "C"
-{
 void
 xaccQueryAddDateMatchTT (
         QofQuery *query,
@@ -146,7 +144,6 @@ xaccQueryAddSingleAccountMatch(QofQuery *query, Account *acc, QofQueryOp op)
     ((QofFakeQuery*)query)->add_single_account_match(acc, op);
 }
 
-} // extern "C"
 
 GList *
 qof_query_run (QofQuery *query)
diff --git a/libgnucash/engine/mocks/gmock-qofinstance.cpp b/libgnucash/engine/mocks/gmock-qofinstance.cpp
index e6e0c2c82..cd253b199 100644
--- a/libgnucash/engine/mocks/gmock-qofinstance.cpp
+++ b/libgnucash/engine/mocks/gmock-qofinstance.cpp
@@ -2,10 +2,7 @@
 
 #include <gmock/gmock.h>
 
-extern "C"
-{
 #include <qofinstance.h>
-}
 #include <qofinstance-p.h>
 
 
@@ -23,8 +20,6 @@ qof_instance_class_init(QofInstanceClass *klass)
     // function is unused, class functions are defined in C++ code
 }
 
-extern "C"
-{
 // This is a reimplementation of the function from qofinstance.cpp
 void
 qof_instance_get (const QofInstance *inst, const gchar *first_prop, ...)
@@ -50,4 +45,3 @@ qof_instance_set (QofInstance *inst, const gchar *first_prop, ...)
     va_end (ap);
 }
 
-} // extern "C"
diff --git a/libgnucash/engine/qof-backend.cpp b/libgnucash/engine/qof-backend.cpp
index 6a5153a99..db03d0831 100644
--- a/libgnucash/engine/qof-backend.cpp
+++ b/libgnucash/engine/qof-backend.cpp
@@ -22,14 +22,11 @@
  *                                                                  *
 \********************************************************************/
 
-extern "C"
-{
 
 #include <config.h>
 #include "qof.h"
 #include <gnc-path.h>
 #include "gncla-dir.h"
-}
 
 #include <string>
 #include <algorithm>
diff --git a/libgnucash/engine/qof-backend.hpp b/libgnucash/engine/qof-backend.hpp
index aac960252..9a66e03c7 100644
--- a/libgnucash/engine/qof-backend.hpp
+++ b/libgnucash/engine/qof-backend.hpp
@@ -41,14 +41,12 @@
 
 #ifndef __QOF_BACKEND_HPP__
 #define __QOF_BACKEND_HPP__
-extern "C"
-{
+
 #include "qofbackend.h"
 #include "qofbook.h"
 #include "qofquery.h"
 #include "qofsession.h"
 #include <gmodule.h>
-}
 
 #include "qofinstance-p.h"
 #include <string>
diff --git a/libgnucash/engine/qof-string-cache.cpp b/libgnucash/engine/qof-string-cache.cpp
index eb236ebd0..d3c9dce44 100644
--- a/libgnucash/engine/qof-string-cache.cpp
+++ b/libgnucash/engine/qof-string-cache.cpp
@@ -27,15 +27,12 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
 #include "qof.h"
-}
 
 /* Uncomment if you need to log anything.
 static QofLogModule log_module = QOF_MOD_UTIL;
diff --git a/libgnucash/engine/qof.h b/libgnucash/engine/qof.h
index ac3fbf569..1549a2dd1 100644
--- a/libgnucash/engine/qof.h
+++ b/libgnucash/engine/qof.h
@@ -68,11 +68,8 @@
 */
 /** @} */
 
-#ifdef __cplusplus
-extern "C++" {
 #include <glib.h>
-}
-#endif
+
 #include "qofid.h"
 #include "qoflog.h"
 #include "gnc-date.h"
diff --git a/libgnucash/engine/qofbook.cpp b/libgnucash/engine/qofbook.cpp
index f523368e9..ba73cdc94 100644
--- a/libgnucash/engine/qofbook.cpp
+++ b/libgnucash/engine/qofbook.cpp
@@ -34,9 +34,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
-
 #include <config.h>
 
 #include <stdlib.h>
@@ -48,8 +45,6 @@ extern "C"
 #endif
 #include <inttypes.h>
 
-}
-
 #include "qof.h"
 #include "qofevent-p.h"
 #include "qofbackend.h"
diff --git a/libgnucash/engine/qofbook.h b/libgnucash/engine/qofbook.h
index df6628e4a..3dba3e957 100644
--- a/libgnucash/engine/qofbook.h
+++ b/libgnucash/engine/qofbook.h
@@ -40,8 +40,8 @@
 #ifndef QOF_BOOK_H
 #define QOF_BOOK_H
 
+#include <glib.h>
 #ifdef __cplusplus
-#include <glib.h> //To preempt it being included extern "C" in a later header.
 class GncOptionDB;
 #else
 typedef struct GncOptionDB GncOptionDB;
diff --git a/libgnucash/engine/qofid.cpp b/libgnucash/engine/qofid.cpp
index 83dfa5221..d48e55f9e 100644
--- a/libgnucash/engine/qofid.cpp
+++ b/libgnucash/engine/qofid.cpp
@@ -24,11 +24,8 @@
 
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
-}
 
 #include "qof.h"
 #include "qofid-p.h"
diff --git a/libgnucash/engine/qofid.h b/libgnucash/engine/qofid.h
index 6c1caac85..ff8de1b44 100644
--- a/libgnucash/engine/qofid.h
+++ b/libgnucash/engine/qofid.h
@@ -23,11 +23,6 @@
 #ifndef QOF_ID_H
 #define QOF_ID_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 /** @addtogroup Entity
     @{ */
 /** @addtogroup Entities
@@ -81,6 +76,11 @@ extern "C"
 #include <string.h>
 #include "guid.h"
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /** QofIdType declaration */
 typedef const gchar * QofIdType;
 /** QofIdTypeConst declaration */
diff --git a/libgnucash/engine/qofinstance.cpp b/libgnucash/engine/qofinstance.cpp
index 12b7dcbfe..c79663741 100644
--- a/libgnucash/engine/qofinstance.cpp
+++ b/libgnucash/engine/qofinstance.cpp
@@ -30,11 +30,8 @@
  */
 
 #include "guid.hpp"
-extern "C"
-{
 #include <config.h>
 #include <glib.h>
-}
 
 #include <utility>
 #include "qof.h"
diff --git a/libgnucash/engine/qofinstance.h b/libgnucash/engine/qofinstance.h
index 5bc1513e1..37dfe310d 100644
--- a/libgnucash/engine/qofinstance.h
+++ b/libgnucash/engine/qofinstance.h
@@ -48,6 +48,10 @@ typedef struct _QofBook       QofBook;
 #include "gnc-date.h"
 #include "qof-gobject.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* --- type macros --- */
 #define QOF_TYPE_INSTANCE            (qof_instance_get_type ())
 #define QOF_INSTANCE(o)              \
@@ -206,6 +210,10 @@ GList* qof_instance_get_typed_referring_object_list(const QofInstance* inst, con
  */
 GList* qof_instance_get_referring_object_list_from_collection(const QofCollection* coll, const QofInstance* ref);
 
+#ifdef __cplusplus
+}
+#endif
+
 /* @} */
 /* @} */
 #endif /* QOF_INSTANCE_H */
diff --git a/libgnucash/engine/qoflog.cpp b/libgnucash/engine/qoflog.cpp
index 993d9c208..3766e1f13 100644
--- a/libgnucash/engine/qoflog.cpp
+++ b/libgnucash/engine/qoflog.cpp
@@ -27,8 +27,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <platform.h>
@@ -48,8 +46,6 @@ extern "C"
 #include <string.h>
 #include <stdio.h>
 
-}
-
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "qof.log"
 #include "qof.h"
diff --git a/libgnucash/engine/qofobject.cpp b/libgnucash/engine/qofobject.cpp
index 0138aad15..ab803e299 100644
--- a/libgnucash/engine/qofobject.cpp
+++ b/libgnucash/engine/qofobject.cpp
@@ -40,18 +40,13 @@ static GList *book_list = NULL;
  * They should be removed when no longer needed
  */
 
-#ifdef __cplusplus
 extern "C"
 {
-#endif
 
 gboolean get_object_is_initialized( void );
 GList* get_object_modules( void );
 GList* get_book_list( void );
-
-#ifdef __cplusplus
 }
-#endif
 
 gboolean
 get_object_is_initialized( void )
diff --git a/libgnucash/engine/qofquery.cpp b/libgnucash/engine/qofquery.cpp
index f531857f0..b51027f37 100644
--- a/libgnucash/engine/qofquery.cpp
+++ b/libgnucash/engine/qofquery.cpp
@@ -22,15 +22,12 @@
 \********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 
 #include <sys/types.h>
 #include <time.h>
 #include <regex.h>
 #include <string.h>
-}
 
 #include "qof.h"
 #include "qof-backend.hpp"
diff --git a/libgnucash/engine/qofsession.cpp b/libgnucash/engine/qofsession.cpp
index 226471241..5ae072fc8 100644
--- a/libgnucash/engine/qofsession.cpp
+++ b/libgnucash/engine/qofsession.cpp
@@ -33,9 +33,6 @@
    */
 #include <glib.h>
 
-extern "C"
-{
-
 #include <config.h>
 
 #include <stdlib.h>
@@ -53,7 +50,6 @@ extern "C"
 #include "qofobject-p.h"
 
 static QofLogModule log_module = QOF_MOD_SESSION;
-} //extern 'C'
 
 #include "qofbook-p.h"
 #include "qof-backend.hpp"
diff --git a/libgnucash/engine/test-core/test-engine-stuff.cpp b/libgnucash/engine/test-core/test-engine-stuff.cpp
index bd0b86216..92a386489 100644
--- a/libgnucash/engine/test-core/test-engine-stuff.cpp
+++ b/libgnucash/engine/test-core/test-engine-stuff.cpp
@@ -38,8 +38,6 @@
 #include <guid.hpp>
 #include <kvp-frame.hpp>
 
-extern "C"
-{
 #include <platform.h>
 #if PLATFORM(WINDOWS)
 #define __STDC_FORMAT_MACROS
@@ -69,7 +67,6 @@ extern "C"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
 #include "test-engine-strings.h"
-}
 #include <qofinstance-p.h>
 
 static gboolean glist_strings_only = FALSE;
diff --git a/libgnucash/engine/test/gtest-gnc-euro.cpp b/libgnucash/engine/test/gtest-gnc-euro.cpp
index 4777d09aa..57585d597 100644
--- a/libgnucash/engine/test/gtest-gnc-euro.cpp
+++ b/libgnucash/engine/test/gtest-gnc-euro.cpp
@@ -22,13 +22,10 @@
 
 #include <gtest/gtest.h>
 #include "../gnc-numeric.hpp"
-extern "C"
-{
 #include <config.h>
 #include "../gnc-euro.h"
 #include "../gnc-commodity.h"
 #include "../gnc-session.h"
-}
 
 class Currencies : public ::testing::Test
 {
diff --git a/libgnucash/engine/test/gtest-gnc-option.cpp b/libgnucash/engine/test/gtest-gnc-option.cpp
index 2e66c0ab9..29d6fee31 100644
--- a/libgnucash/engine/test/gtest-gnc-option.cpp
+++ b/libgnucash/engine/test/gtest-gnc-option.cpp
@@ -26,8 +26,6 @@
 #include "gnc-option-impl.hpp"
 #include "gnc-option-ui.hpp"
 #include "guid.hpp"
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
 #include "Account.h"
@@ -36,7 +34,6 @@ extern "C"
 #include "gnc-date.h"
 #include <time.h>
 #include "gnc-session.h"
-}
 
 TEST(GncOption, test_string_ctor)
 {
diff --git a/libgnucash/engine/test/gtest-gnc-optiondb.cpp b/libgnucash/engine/test/gtest-gnc-optiondb.cpp
index ecedeff80..68070d5f7 100644
--- a/libgnucash/engine/test/gtest-gnc-optiondb.cpp
+++ b/libgnucash/engine/test/gtest-gnc-optiondb.cpp
@@ -28,10 +28,7 @@
 #include "kvp-value.hpp"
 #include <glib-2.0/glib.h>
 
-extern "C"
-{
 #include "gnc-session.h"
-}
 
 using GncOptionDBPtr = std::unique_ptr<GncOptionDB>;
 
diff --git a/libgnucash/engine/test/gtest-import-map.cpp b/libgnucash/engine/test/gtest-import-map.cpp
index c7a769b58..a7f83e03e 100644
--- a/libgnucash/engine/test/gtest-import-map.cpp
+++ b/libgnucash/engine/test/gtest-import-map.cpp
@@ -20,12 +20,9 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 \********************************************************************/
 
-extern "C"
-{
 #include <config.h>
 #include "../Account.h"
 #include <qof.h>
-}
 
 #include <qofinstance-p.h>
 #include <kvp-frame.hpp>
diff --git a/libgnucash/engine/test/test-account-object.cpp b/libgnucash/engine/test/test-account-object.cpp
index f1d21a570..004abb054 100644
--- a/libgnucash/engine/test/test-account-object.cpp
+++ b/libgnucash/engine/test/test-account-object.cpp
@@ -26,15 +26,12 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <unistd.h>
 #include "qof.h"
 #include "Account.h"
 #include "cashobjects.h"
 #include "test-engine-stuff.h"
-}
 #include <qofinstance-p.h>
 #include "test-stuff.h"
 
diff --git a/libgnucash/engine/test/test-commodities.cpp b/libgnucash/engine/test/test-commodities.cpp
index 24118277f..089880f9d 100644
--- a/libgnucash/engine/test/test-commodities.cpp
+++ b/libgnucash/engine/test/test-commodities.cpp
@@ -24,14 +24,11 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include "gnc-commodity.h"
 #include "qof.h"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
-}
 
 static void
 test_commodity(void)
diff --git a/libgnucash/engine/test/test-gnc-date.c b/libgnucash/engine/test/test-gnc-date.c
index 991d36918..aa4587269 100644
--- a/libgnucash/engine/test/test-gnc-date.c
+++ b/libgnucash/engine/test/test-gnc-date.c
@@ -21,11 +21,6 @@
  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  ********************************************************************/
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 #include <config.h>
 #include "platform.h"
 #include <string.h>
@@ -35,9 +30,6 @@ extern "C"
 #include <unittest-support.h>
 /* Add specific headers for this class */
 
-#ifdef __cplusplus
-}
-#endif
 #include "../gnc-date.h"
 #include "../gnc-date-p.h"
 #include <locale.h>
diff --git a/libgnucash/engine/test/test-group-vs-book.cpp b/libgnucash/engine/test/test-group-vs-book.cpp
index 010913ebb..45016a4ef 100644
--- a/libgnucash/engine/test/test-group-vs-book.cpp
+++ b/libgnucash/engine/test/test-group-vs-book.cpp
@@ -22,8 +22,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
 #include "cashobjects.h"
@@ -32,7 +30,6 @@ extern "C"
 #include "gnc-engine.h"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
-}
 
 static gboolean
 account_tree_has_book (Account *parent, QofBook *book)
diff --git a/libgnucash/engine/test/test-guid.cpp b/libgnucash/engine/test/test-guid.cpp
index ad42ec49c..bc90905e3 100644
--- a/libgnucash/engine/test/test-guid.cpp
+++ b/libgnucash/engine/test/test-guid.cpp
@@ -28,15 +28,12 @@
 #include <guid.hpp>
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <ctype.h>
 #include "cashobjects.h"
 #include "test-stuff.h"
 #include "test-engine-stuff.h"
 #include "qof.h"
-}
 #define NENT 50123
 
 static void test_null_guid(void)
diff --git a/libgnucash/engine/test/test-lots.cpp b/libgnucash/engine/test/test-lots.cpp
index c02c7ab49..7bf3a3857 100644
--- a/libgnucash/engine/test/test-lots.cpp
+++ b/libgnucash/engine/test/test-lots.cpp
@@ -26,8 +26,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <ctype.h>
 #include "qof.h"
@@ -38,7 +36,6 @@ extern "C"
 #include "test-stuff.h"
 #include "test-engine-stuff.h"
 #include "Transaction.h"
-}
 
 static gint transaction_num = 32;
 static gint	max_iterate = 1;
diff --git a/libgnucash/engine/test/test-numeric.cpp b/libgnucash/engine/test/test-numeric.cpp
index d6e19f4eb..41ef28fa0 100644
--- a/libgnucash/engine/test/test-numeric.cpp
+++ b/libgnucash/engine/test/test-numeric.cpp
@@ -23,15 +23,12 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <ctype.h>
 #include "cashobjects.h"
 #include "test-stuff.h"
 #include "test-engine-stuff.h"
 #include "gnc-numeric.h"
-}
 
 #define NREPS 2
 
diff --git a/libgnucash/engine/test/test-qofbook.c b/libgnucash/engine/test/test-qofbook.c
index 9f3bca22b..9691dfa12 100644
--- a/libgnucash/engine/test/test-qofbook.c
+++ b/libgnucash/engine/test/test-qofbook.c
@@ -19,19 +19,11 @@
  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 \********************************************************************/
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 #include <config.h>
 #include <string.h>
 #include <glib.h>
 #include <inttypes.h>
 #include <unittest-support.h>
-#ifdef __cplusplus
-}
-#endif
 
 #include "../qof.h"
 #include "../gnc-features.h"
diff --git a/libgnucash/engine/test/test-qofinstance.cpp b/libgnucash/engine/test/test-qofinstance.cpp
index 9299e4223..ee585e45a 100644
--- a/libgnucash/engine/test/test-qofinstance.cpp
+++ b/libgnucash/engine/test/test-qofinstance.cpp
@@ -23,12 +23,9 @@
 #include <glib.h>
 #include <guid.hpp>
 
-extern "C"
-{
 #include <config.h>
 #include <unittest-support.h>
 #include "../qof.h"
-}
 #include "../qof-backend.hpp"
 #include "../kvp-frame.hpp"
 static const gchar *suitename = "/qof/qofinstance";
diff --git a/libgnucash/engine/test/test-qofobject.c b/libgnucash/engine/test/test-qofobject.c
index fae5bc843..0016cc62e 100644
--- a/libgnucash/engine/test/test-qofobject.c
+++ b/libgnucash/engine/test/test-qofobject.c
@@ -19,18 +19,10 @@
  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 ********************************************************************/
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 #include <config.h>
 #include <string.h>
 #include <glib.h>
 #include <unittest-support.h>
-#ifdef __cplusplus
-}
-#endif
 
 #include "../qof.h"
 #include "../qofobject-p.h"
@@ -85,19 +77,10 @@ new_object( QofIdType e_type, const char *type_label, MockFields field)
     return object;
 }
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 extern gboolean get_object_is_initialized( void );
 extern GList* get_object_modules( void );
 extern GList* get_book_list( void );
 
-#ifdef __cplusplus
-}
-#endif
-
 static void
 setup( Fixture *fixture, gconstpointer pData )
 {
diff --git a/libgnucash/engine/test/test-query.cpp b/libgnucash/engine/test/test-query.cpp
index 94ab2c0d8..112a1ad6b 100644
--- a/libgnucash/engine/test/test-query.cpp
+++ b/libgnucash/engine/test/test-query.cpp
@@ -22,8 +22,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
 #include "cashobjects.h"
@@ -32,7 +30,6 @@ extern "C"
 #include "gnc-engine.h"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
-}
 
 static int
 test_trans_query (Transaction *trans, gpointer data)
diff --git a/libgnucash/engine/test/test-split-vs-account.cpp b/libgnucash/engine/test/test-split-vs-account.cpp
index 81c42d635..9e2f97b6e 100644
--- a/libgnucash/engine/test/test-split-vs-account.cpp
+++ b/libgnucash/engine/test/test-split-vs-account.cpp
@@ -23,8 +23,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include "qof.h"
 #include "cashobjects.h"
@@ -34,7 +32,6 @@ extern "C"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
 #include "Transaction.h"
-}
 
 static void
 run_test (void)
diff --git a/libgnucash/engine/test/test-transaction-reversal.cpp b/libgnucash/engine/test/test-transaction-reversal.cpp
index e5183cc5a..191f63036 100644
--- a/libgnucash/engine/test/test-transaction-reversal.cpp
+++ b/libgnucash/engine/test/test-transaction-reversal.cpp
@@ -22,8 +22,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include "cashobjects.h"
@@ -32,7 +30,6 @@ extern "C"
 #include "TransLog.h"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
-}
 
 #define print_gnc_numeric(num) fprintf(stderr, "%s\n", gnc_numeric_to_string(num))
 
diff --git a/libgnucash/engine/test/test-transaction-voiding.cpp b/libgnucash/engine/test/test-transaction-voiding.cpp
index e4aa60c63..7ae5264b5 100644
--- a/libgnucash/engine/test/test-transaction-voiding.cpp
+++ b/libgnucash/engine/test/test-transaction-voiding.cpp
@@ -22,8 +22,6 @@
  */
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include "cashobjects.h"
@@ -32,7 +30,6 @@ extern "C"
 #include "test-engine-stuff.h"
 #include "test-stuff.h"
 #include "Transaction.h"
-}
 
 #define print_gnc_numeric(num) fprintf(stderr, "%s\n", gnc_numeric_to_string(num))
 
diff --git a/libgnucash/engine/test/utest-Account.cpp b/libgnucash/engine/test/utest-Account.cpp
index 6e4a17661..2223d8a70 100644
--- a/libgnucash/engine/test/utest-Account.cpp
+++ b/libgnucash/engine/test/utest-Account.cpp
@@ -21,8 +21,6 @@
  ********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include <unittest-support.h>
@@ -40,8 +38,7 @@ extern "C"
 #define USE_CLANG_FUNC_SIG 1
 #endif
 static const gchar *suitename = "/engine/Account";
-void test_suite_account (void);
-}
+extern "C" void test_suite_account (void);
 
 #include <qofinstance-p.h>
 #include <kvp-frame.hpp>
diff --git a/libgnucash/engine/test/utest-Split.cpp b/libgnucash/engine/test/utest-Split.cpp
index c0fa7400f..059c483b7 100644
--- a/libgnucash/engine/test/utest-Split.cpp
+++ b/libgnucash/engine/test/utest-Split.cpp
@@ -23,8 +23,6 @@
  ********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include <unittest-support.h>
@@ -42,8 +40,7 @@ extern "C"
 #endif
 
 static const gchar *suitename = "/engine/Split";
-void test_suite_split ( void );
-}
+extern "C" void test_suite_split ( void );
 
 #include <qofinstance-p.h>
 #include <kvp-frame.hpp>
diff --git a/libgnucash/engine/test/utest-Transaction.cpp b/libgnucash/engine/test/utest-Transaction.cpp
index 878b5b6bc..3a9412bbb 100644
--- a/libgnucash/engine/test/utest-Transaction.cpp
+++ b/libgnucash/engine/test/utest-Transaction.cpp
@@ -23,8 +23,6 @@
  ********************************************************************/
 #include <glib.h>
 
-extern "C"
-{
 #include <config.h>
 #include <string.h>
 #include <unittest-support.h>
@@ -42,8 +40,7 @@ extern "C"
 #endif
 
 static const gchar *suitename = "/engine/Transaction";
-void test_suite_transaction ( void );
-}
+extern "C" void test_suite_transaction ( void );
 
 #include <qof-backend.hpp>
 #include <kvp-frame.hpp>
diff --git a/libgnucash/gnc-module/gnc-module.h b/libgnucash/gnc-module/gnc-module.h
index 248ab6aef..74a8a938f 100644
--- a/libgnucash/gnc-module/gnc-module.h
+++ b/libgnucash/gnc-module/gnc-module.h
@@ -28,6 +28,10 @@
 
 #include <glib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef void * GNCModule;
 
 #define DEFAULT_MODULE_PATH "/usr/local/gnucash/lib/modules"
@@ -47,4 +51,8 @@ GNCModule       gnc_module_load(const gchar * module_name, gint iface);
 GNCModule       gnc_module_load_optional(const gchar * module_name, gint iface);
 int             gnc_module_unload(GNCModule mod);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif



Summary of changes:
 bindings/app-utils.i                                | 12 ++----------
 bindings/engine.i                                   |  8 --------
 bindings/guile/glib-guile.h                         |  8 ++++++++
 bindings/guile/gnc-engine-guile.cpp                 |  4 +---
 bindings/guile/gnc-engine-guile.h                   |  8 ++++----
 bindings/guile/gnc-guile-utils.h                    |  8 ++++++++
 bindings/guile/gnc-helpers.h                        |  8 ++++++++
 bindings/guile/gnc-kvp-guile.cpp                    |  3 ---
 bindings/guile/gnc-kvp-guile.h                      |  5 +++--
 bindings/guile/test/test-print-queries.cpp          |  4 ----
 bindings/guile/test/test-scm-query-string.cpp       |  3 ---
 bindings/guile/test/test-scm-query.cpp              |  3 ---
 common/test-core/unittest-support.h                 |  9 +++++++++
 gnucash/gnome-search/gnc-general-search.h           |  8 ++++++++
 gnucash/gnome-search/search-core-type.h             |  7 +++++++
 gnucash/gnome-utils/dialog-doclink-utils.h          |  8 ++++++++
 gnucash/gnome-utils/dialog-file-access.h            |  8 ++++++++
 gnucash/gnome-utils/dialog-options.cpp              |  6 ------
 gnucash/gnome-utils/dialog-preferences.h            |  8 ++++++++
 gnucash/gnome-utils/dialog-reset-warnings.h         |  9 +++++++++
 gnucash/gnome-utils/dialog-transfer.cpp             |  2 --
 gnucash/gnome-utils/dialog-transfer.h               |  8 ++++++++
 gnucash/gnome-utils/dialog-utils.h                  |  8 ++++++++
 gnucash/gnome-utils/gnc-account-sel.h               |  8 ++++++++
 gnucash/gnome-utils/gnc-amount-edit.h               |  8 ++++++++
 gnucash/gnome-utils/gnc-autoclear.h                 |  8 ++++++++
 gnucash/gnome-utils/gnc-autosave.h                  |  8 ++++++++
 gnucash/gnome-utils/gnc-commodity-edit.h            |  8 ++++++++
 gnucash/gnome-utils/gnc-component-manager.h         |  8 ++++++++
 gnucash/gnome-utils/gnc-currency-edit.h             |  8 ++++++++
 gnucash/gnome-utils/gnc-date-edit.h                 |  9 +++++++++
 gnucash/gnome-utils/gnc-date-format.h               |  8 ++++++++
 gnucash/gnome-utils/gnc-file.h                      |  8 ++++++++
 gnucash/gnome-utils/gnc-frequency.h                 |  8 ++++++++
 gnucash/gnome-utils/gnc-general-select.h            |  8 ++++++++
 gnucash/gnome-utils/gnc-gnome-utils.h               |  8 ++++++++
 gnucash/gnome-utils/gnc-gobject-utils.h             |  8 ++++++++
 gnucash/gnome-utils/gnc-gtk-utils.h                 |  8 ++++++++
 gnucash/gnome-utils/gnc-gui-query.h                 |  8 ++++++++
 gnucash/gnome-utils/gnc-main-window.cpp             |  3 ---
 gnucash/gnome-utils/gnc-option-gtk-ui.cpp           |  3 ---
 gnucash/gnome-utils/gnc-splash.h                    |  8 ++++++++
 gnucash/gnome-utils/gnc-tree-model-budget.h         |  8 ++++++++
 gnucash/gnome-utils/gnc-ui.h                        |  8 ++++++++
 gnucash/gnome-utils/misc-gnome-utils.h              |  8 ++++++++
 gnucash/gnome-utils/print-session.h                 |  8 ++++++++
 gnucash/gnome-utils/test/test-autoclear.cpp         |  2 --
 gnucash/gnome/assistant-hierarchy.cpp               |  3 ---
 gnucash/gnome/assistant-loan.cpp                    |  3 ---
 gnucash/gnome/assistant-loan.h                      |  9 +++++++++
 gnucash/gnome/assistant-stock-transaction.cpp       |  2 --
 gnucash/gnome/assistant-stock-transaction.h         |  8 ++++++++
 gnucash/gnome/business-gnome-utils.h                |  8 ++++++++
 gnucash/gnome/business-options-gnome.cpp            |  3 ---
 gnucash/gnome/dialog-custom-report.h                |  8 ++++++++
 gnucash/gnome/dialog-new-user.h                     |  8 ++++++++
 gnucash/gnome/dialog-price-edit-db.cpp              |  2 --
 gnucash/gnome/dialog-report-column-view.cpp         |  3 ---
 gnucash/gnome/dialog-report-column-view.hpp         |  4 ++--
 gnucash/gnome/dialog-report-style-sheet.cpp         |  3 ---
 gnucash/gnome/gnc-plugin-page-report.cpp            |  6 +-----
 gnucash/gnome/top-level.h                           |  8 ++++++++
 gnucash/gnome/window-report.cpp                     |  3 ---
 gnucash/gnucash-cli.cpp                             |  2 --
 gnucash/gnucash-commands.cpp                        |  2 --
 gnucash/gnucash-core-app.cpp                        |  2 --
 gnucash/gnucash-locale-platform.h                   |  8 ++++++++
 gnucash/gnucash.cpp                                 |  2 --
 gnucash/html/gnc-html-factory.h                     |  8 ++++++++
 gnucash/html/gnc-html-history.h                     |  8 ++++++++
 gnucash/html/gnc-html.c                             |  5 +++--
 .../csv-imp/assistant-csv-price-import.cpp          |  3 ---
 .../csv-imp/assistant-csv-price-import.h            |  8 ++++++++
 .../csv-imp/assistant-csv-trans-import.cpp          |  3 ---
 .../csv-imp/assistant-csv-trans-import.h            |  9 +++++++++
 gnucash/import-export/csv-imp/gnc-csv-account-map.h |  8 ++++++++
 .../import-export/csv-imp/gnc-csv-gnumeric-popup.h  |  8 ++++++++
 .../import-export/csv-imp/gnc-imp-props-price.cpp   |  2 --
 .../import-export/csv-imp/gnc-imp-props-price.hpp   |  2 --
 gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp  |  4 ----
 gnucash/import-export/csv-imp/gnc-imp-props-tx.hpp  |  2 --
 .../csv-imp/gnc-imp-settings-csv-price.cpp          |  3 ---
 .../csv-imp/gnc-imp-settings-csv-price.hpp          |  2 --
 .../csv-imp/gnc-imp-settings-csv-tx.cpp             |  3 ---
 .../csv-imp/gnc-imp-settings-csv-tx.hpp             |  2 --
 .../import-export/csv-imp/gnc-imp-settings-csv.cpp  |  3 ---
 .../import-export/csv-imp/gnc-imp-settings-csv.hpp  |  2 --
 gnucash/import-export/csv-imp/gnc-import-price.cpp  |  2 --
 gnucash/import-export/csv-imp/gnc-import-price.hpp  |  2 --
 gnucash/import-export/csv-imp/gnc-import-tx.cpp     |  2 --
 gnucash/import-export/csv-imp/gnc-import-tx.hpp     |  2 --
 gnucash/import-export/csv-imp/gnc-tokenizer-csv.cpp |  4 +---
 gnucash/import-export/csv-imp/gnc-tokenizer-csv.hpp |  2 --
 .../import-export/csv-imp/gnc-tokenizer-dummy.hpp   |  2 --
 gnucash/import-export/csv-imp/gnc-tokenizer-fw.hpp  |  2 --
 gnucash/import-export/csv-imp/gnc-tokenizer.cpp     |  2 --
 gnucash/import-export/csv-imp/gnc-tokenizer.hpp     |  2 --
 gnucash/import-export/import-account-matcher.h      |  8 ++++++++
 gnucash/import-export/import-backend.h              |  8 ++++++++
 gnucash/import-export/import-main-matcher.h         |  8 ++++++++
 gnucash/import-export/import-pending-matches.h      |  8 ++++++++
 .../test/gtest-import-account-matcher.cpp           |  3 ---
 gnucash/import-export/test/gtest-import-backend.cpp |  3 ---
 .../test/test-import-pending-matches.cpp            |  2 --
 gnucash/register/register-gnome/gnucash-register.h  |  9 +++++++++
 gnucash/report/gnc-report.cpp                       |  3 ---
 libgnucash/app-utils/QuickFill.h                    |  8 ++++++++
 libgnucash/app-utils/calculation/fin.c              |  5 +++--
 libgnucash/app-utils/gfec.h                         |  8 ++++++++
 libgnucash/app-utils/gnc-account-merge.h            |  8 ++++++++
 libgnucash/app-utils/gnc-exp-parser.h               |  8 ++++++++
 libgnucash/app-utils/gnc-gsettings.cpp              |  2 --
 libgnucash/app-utils/gnc-gsettings.h                |  8 ++++++++
 libgnucash/app-utils/gnc-prefs-utils.h              |  8 ++++++++
 libgnucash/app-utils/gnc-quotes.cpp                 |  2 --
 libgnucash/app-utils/gnc-state.h                    |  8 ++++++++
 libgnucash/app-utils/gnc-ui-util.c                  |  9 +++++----
 libgnucash/app-utils/gnc-ui-util.h                  |  8 ++++++++
 libgnucash/app-utils/test/gtest-gnc-quotes.cpp      |  5 ++---
 .../app-utils/test/test-print-parse-amount.cpp      |  3 ---
 libgnucash/app-utils/test/test-sx.cpp               |  3 ---
 libgnucash/backend/dbi/gnc-backend-dbi.cpp          |  4 ----
 libgnucash/backend/dbi/gnc-backend-dbi.hpp          |  5 ++---
 libgnucash/backend/dbi/gnc-dbiprovider.hpp          |  3 ---
 libgnucash/backend/dbi/gnc-dbiproviderimpl.hpp      |  4 +---
 libgnucash/backend/dbi/gnc-dbisqlconnection.cpp     |  3 ---
 libgnucash/backend/dbi/gnc-dbisqlresult.cpp         |  3 ---
 .../backend/dbi/test/test-backend-dbi-basic.cpp     |  6 ------
 libgnucash/backend/dbi/test/test-backend-dbi.cpp    |  3 ---
 .../backend/dbi/test/test-dbi-business-stuff.cpp    |  3 ---
 libgnucash/backend/dbi/test/test-dbi-stuff.cpp      |  3 ---
 libgnucash/backend/sql/gnc-account-sql.cpp          |  3 ---
 libgnucash/backend/sql/gnc-address-sql.cpp          |  3 ---
 libgnucash/backend/sql/gnc-bill-term-sql.cpp        |  3 ---
 libgnucash/backend/sql/gnc-book-sql.cpp             |  3 ---
 libgnucash/backend/sql/gnc-budget-sql.cpp           |  3 ---
 libgnucash/backend/sql/gnc-commodity-sql.cpp        |  3 ---
 libgnucash/backend/sql/gnc-customer-sql.cpp         |  3 ---
 libgnucash/backend/sql/gnc-employee-sql.cpp         |  3 ---
 libgnucash/backend/sql/gnc-entry-sql.cpp            |  3 ---
 libgnucash/backend/sql/gnc-invoice-sql.cpp          |  3 ---
 libgnucash/backend/sql/gnc-job-sql.cpp              |  3 ---
 libgnucash/backend/sql/gnc-lots-sql.cpp             |  3 ---
 libgnucash/backend/sql/gnc-order-sql.cpp            |  3 ---
 libgnucash/backend/sql/gnc-owner-sql.cpp            |  3 ---
 libgnucash/backend/sql/gnc-price-sql.cpp            |  3 ---
 libgnucash/backend/sql/gnc-recurrence-sql.cpp       |  3 ---
 libgnucash/backend/sql/gnc-schedxaction-sql.cpp     |  3 ---
 libgnucash/backend/sql/gnc-slots-sql.cpp            |  3 ---
 libgnucash/backend/sql/gnc-sql-backend.cpp          |  3 ---
 libgnucash/backend/sql/gnc-sql-backend.hpp          |  4 +---
 .../backend/sql/gnc-sql-column-table-entry.cpp      |  3 ---
 .../backend/sql/gnc-sql-column-table-entry.hpp      |  3 ---
 libgnucash/backend/sql/gnc-sql-connection.hpp       |  3 ---
 libgnucash/backend/sql/gnc-sql-object-backend.cpp   |  3 ---
 libgnucash/backend/sql/gnc-sql-object-backend.hpp   |  4 +---
 libgnucash/backend/sql/gnc-sql-result.cpp           |  3 ---
 libgnucash/backend/sql/gnc-sql-result.hpp           |  4 +---
 libgnucash/backend/sql/gnc-tax-table-sql.cpp        |  3 ---
 libgnucash/backend/sql/gnc-transaction-sql.cpp      |  3 ---
 libgnucash/backend/sql/gnc-vendor-sql.cpp           |  3 ---
 libgnucash/backend/sql/test/test-column-types.cpp   |  6 ------
 libgnucash/backend/sql/test/test-sqlbe.cpp          |  3 ---
 .../backend/sql/test/utest-gnc-backend-sql.cpp      |  3 ---
 libgnucash/backend/xml/gnc-account-xml-v2.cpp       |  3 ---
 libgnucash/backend/xml/gnc-address-xml-v2.cpp       |  3 ---
 libgnucash/backend/xml/gnc-address-xml-v2.h         |  5 ++---
 libgnucash/backend/xml/gnc-backend-xml.cpp          |  3 ---
 libgnucash/backend/xml/gnc-bill-term-xml-v2.cpp     |  3 ---
 libgnucash/backend/xml/gnc-book-xml-v2.cpp          |  3 ---
 libgnucash/backend/xml/gnc-budget-xml-v2.cpp        |  3 ---
 libgnucash/backend/xml/gnc-commodity-xml-v2.cpp     |  3 ---
 libgnucash/backend/xml/gnc-customer-xml-v2.cpp      |  3 ---
 libgnucash/backend/xml/gnc-employee-xml-v2.cpp      |  3 ---
 libgnucash/backend/xml/gnc-entry-xml-v2.cpp         |  3 ---
 libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp      |  3 ---
 libgnucash/backend/xml/gnc-invoice-xml-v2.cpp       |  3 ---
 libgnucash/backend/xml/gnc-job-xml-v2.cpp           |  3 ---
 libgnucash/backend/xml/gnc-lot-xml-v2.cpp           |  3 ---
 libgnucash/backend/xml/gnc-order-xml-v2.cpp         |  3 ---
 libgnucash/backend/xml/gnc-owner-xml-v2.cpp         |  3 ---
 libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp       |  3 ---
 libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp    |  3 ---
 libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp  |  3 ---
 libgnucash/backend/xml/gnc-tax-table-xml-v2.cpp     |  3 ---
 libgnucash/backend/xml/gnc-transaction-xml-v2.cpp   |  3 ---
 libgnucash/backend/xml/gnc-vendor-xml-v2.cpp        |  3 ---
 libgnucash/backend/xml/gnc-xml-backend.cpp          |  4 ----
 libgnucash/backend/xml/gnc-xml-backend.hpp          |  3 ---
 libgnucash/backend/xml/io-example-account.cpp       |  3 ---
 libgnucash/backend/xml/io-gncxml-gen.cpp            |  3 ---
 libgnucash/backend/xml/io-gncxml-v1.cpp             |  3 ---
 libgnucash/backend/xml/io-gncxml-v2.cpp             |  3 ---
 libgnucash/backend/xml/io-utils.cpp                 |  3 ---
 libgnucash/backend/xml/sixtp-dom-generators.cpp     |  3 ---
 libgnucash/backend/xml/sixtp-dom-parsers.cpp        |  3 ---
 libgnucash/backend/xml/sixtp-stack.cpp              |  3 ---
 libgnucash/backend/xml/sixtp-to-dom-parser.cpp      |  3 ---
 libgnucash/backend/xml/sixtp-utils.cpp              |  3 ---
 libgnucash/backend/xml/sixtp.cpp                    |  3 ---
 .../backend/xml/test/test-dom-converters1.cpp       |  3 ---
 libgnucash/backend/xml/test/test-file-stuff.cpp     |  3 ---
 libgnucash/backend/xml/test/test-kvp-frames.cpp     |  3 ---
 libgnucash/backend/xml/test/test-load-backend.cpp   |  3 ---
 .../backend/xml/test/test-load-example-account.cpp  |  3 ---
 libgnucash/backend/xml/test/test-load-xml2.cpp      |  3 ---
 .../backend/xml/test/test-string-converters.cpp     |  3 ---
 libgnucash/backend/xml/test/test-xml-account.cpp    |  3 ---
 libgnucash/backend/xml/test/test-xml-commodity.cpp  |  3 ---
 libgnucash/backend/xml/test/test-xml-pricedb.cpp    |  3 ---
 .../backend/xml/test/test-xml-transaction.cpp       |  3 ---
 libgnucash/backend/xml/test/test-xml2-is-file.cpp   |  9 +++------
 libgnucash/core-utils/gnc-environment.h             |  8 ++++++++
 libgnucash/core-utils/gnc-filepath-utils.cpp        |  2 --
 libgnucash/core-utils/gnc-filepath-utils.h          |  8 ++++++++
 libgnucash/core-utils/gnc-path.h                    |  7 +++++++
 libgnucash/core-utils/gnc-prefs.h                   | 12 ++++++++----
 libgnucash/core-utils/gnc-version.h                 |  8 ++++++++
 libgnucash/core-utils/test/gtest-path-utilities.cpp |  3 ---
 libgnucash/engine/Account.cpp                       |  2 --
 libgnucash/engine/Query.h                           |  8 ++++++++
 libgnucash/engine/Recurrence.h                      |  8 ++++++++
 libgnucash/engine/SX-book-p.h                       |  8 ++++++++
 libgnucash/engine/SX-book.h                         | 13 +++++++++----
 libgnucash/engine/SX-ttinfo.h                       |  8 ++++++++
 libgnucash/engine/SchedXaction.h                    |  8 ++++++++
 libgnucash/engine/Scrub.h                           |  8 ++++++++
 libgnucash/engine/Scrub3.h                          |  9 +++++++++
 libgnucash/engine/SplitP.h                          |  8 ++++++++
 libgnucash/engine/TransLog.h                        |  8 ++++++++
 libgnucash/engine/TransactionP.h                    |  8 ++++++++
 libgnucash/engine/cashobjects.h                     |  8 ++++++++
 libgnucash/engine/engine-helpers.h                  | 12 ++++++++----
 libgnucash/engine/gnc-accounting-period.h           |  8 ++++++++
 libgnucash/engine/gnc-aqbanking-templates.cpp       |  3 ---
 libgnucash/engine/gnc-commodity.h                   |  4 ----
 libgnucash/engine/gnc-commodity.hpp                 |  2 --
 libgnucash/engine/gnc-date.cpp                      |  3 ---
 libgnucash/engine/gnc-date.h                        | 12 +++---------
 libgnucash/engine/gnc-datetime.cpp                  |  3 ---
 libgnucash/engine/gnc-engine.h                      |  4 ----
 libgnucash/engine/gnc-euro.h                        |  8 ++++++++
 libgnucash/engine/gnc-features.cpp                  |  3 ---
 libgnucash/engine/gnc-hooks.h                       |  8 ++++++++
 libgnucash/engine/gnc-int128.cpp                    | 18 ++++++++----------
 libgnucash/engine/gnc-int128.hpp                    |  5 +----
 libgnucash/engine/gnc-numeric.cpp                   | 21 ++++++++++-----------
 libgnucash/engine/gnc-numeric.h                     |  5 +++--
 libgnucash/engine/gnc-option-date.cpp               |  3 ---
 libgnucash/engine/gnc-option-date.hpp               |  3 ---
 libgnucash/engine/gnc-option-impl.cpp               |  3 ---
 libgnucash/engine/gnc-option-impl.hpp               |  4 +---
 libgnucash/engine/gnc-option.cpp                    |  3 ---
 libgnucash/engine/gnc-option.hpp                    |  2 +-
 libgnucash/engine/gnc-optiondb-impl.hpp             |  4 +---
 libgnucash/engine/gnc-optiondb.cpp                  |  8 ++++----
 libgnucash/engine/gnc-optiondb.h                    |  9 +++++----
 libgnucash/engine/gnc-optiondb.hpp                  |  4 +---
 libgnucash/engine/gnc-pricedb-p.h                   |  8 ++++++++
 libgnucash/engine/gnc-session.h                     |  8 ++++++++
 libgnucash/engine/gnc-timezone.cpp                  |  3 ---
 libgnucash/engine/gnc-timezone.hpp                  |  4 +---
 libgnucash/engine/gnc-uri-utils.h                   |  8 ++++++++
 libgnucash/engine/gncAddress.h                      |  8 ++++++++
 libgnucash/engine/gncBillTerm.h                     |  8 ++++++++
 libgnucash/engine/gncBillTermP.h                    |  8 ++++++++
 libgnucash/engine/gncBusiness.h                     |  5 +----
 libgnucash/engine/gncCustomer.h                     |  9 +++++++++
 libgnucash/engine/gncEmployee.h                     |  8 ++++++++
 libgnucash/engine/gncEntry.h                        | 10 +++++++---
 libgnucash/engine/gncEntryP.h                       |  8 ++++++++
 libgnucash/engine/gncInvoice.h                      |  8 ++++++++
 libgnucash/engine/gncInvoiceP.h                     |  9 +++++++++
 libgnucash/engine/gncJob.h                          |  8 ++++++++
 libgnucash/engine/gncOrder.h                        |  8 ++++++++
 libgnucash/engine/gncOwner.h                        |  9 +++++++++
 libgnucash/engine/gncTaxTable.h                     |  8 ++++++++
 libgnucash/engine/gncTaxTableP.h                    |  8 ++++++++
 libgnucash/engine/gncVendor.h                       |  9 +++++++++
 libgnucash/engine/guid.cpp                          |  3 ---
 libgnucash/engine/guid.hpp                          |  3 +--
 libgnucash/engine/kvp-frame.cpp                     |  4 ----
 libgnucash/engine/kvp-value.hpp                     |  3 ---
 libgnucash/engine/mocks/fake-qofquery.cpp           |  3 ---
 libgnucash/engine/mocks/gmock-qofinstance.cpp       |  6 ------
 libgnucash/engine/qof-backend.cpp                   |  3 ---
 libgnucash/engine/qof-backend.hpp                   |  4 +---
 libgnucash/engine/qof-string-cache.cpp              |  3 ---
 libgnucash/engine/qof.h                             |  5 +----
 libgnucash/engine/qofbook.cpp                       |  5 -----
 libgnucash/engine/qofbook.h                         |  2 +-
 libgnucash/engine/qofid.cpp                         |  3 ---
 libgnucash/engine/qofid.h                           | 10 +++++-----
 libgnucash/engine/qofinstance.cpp                   |  3 ---
 libgnucash/engine/qofinstance.h                     |  8 ++++++++
 libgnucash/engine/qoflog.cpp                        |  4 ----
 libgnucash/engine/qofobject.cpp                     |  5 -----
 libgnucash/engine/qofquery.cpp                      |  3 ---
 libgnucash/engine/qofsession.cpp                    |  4 ----
 libgnucash/engine/test-core/test-engine-stuff.cpp   |  3 ---
 libgnucash/engine/test/gtest-gnc-euro.cpp           |  3 ---
 libgnucash/engine/test/gtest-gnc-int128.cpp         | 14 +++++++-------
 libgnucash/engine/test/gtest-gnc-option.cpp         |  3 ---
 libgnucash/engine/test/gtest-gnc-optiondb.cpp       |  3 ---
 libgnucash/engine/test/gtest-import-map.cpp         |  3 ---
 libgnucash/engine/test/test-account-object.cpp      |  3 ---
 libgnucash/engine/test/test-commodities.cpp         |  3 ---
 libgnucash/engine/test/test-gnc-date.c              |  8 --------
 libgnucash/engine/test/test-group-vs-book.cpp       |  3 ---
 libgnucash/engine/test/test-guid.cpp                |  3 ---
 libgnucash/engine/test/test-lots.cpp                |  3 ---
 libgnucash/engine/test/test-numeric.cpp             |  3 ---
 libgnucash/engine/test/test-qofbook.c               |  8 --------
 libgnucash/engine/test/test-qofinstance.cpp         |  3 ---
 libgnucash/engine/test/test-qofobject.c             | 17 -----------------
 libgnucash/engine/test/test-query.cpp               |  3 ---
 libgnucash/engine/test/test-split-vs-account.cpp    |  3 ---
 .../engine/test/test-transaction-reversal.cpp       |  3 ---
 libgnucash/engine/test/test-transaction-voiding.cpp |  3 ---
 libgnucash/engine/test/utest-Account.cpp            |  5 +----
 libgnucash/engine/test/utest-Split.cpp              |  5 +----
 libgnucash/engine/test/utest-Transaction.cpp        |  5 +----
 libgnucash/gnc-module/gnc-module.h                  |  8 ++++++++
 323 files changed, 906 insertions(+), 748 deletions(-)



More information about the gnucash-changes mailing list