From: Daiki Ueno Date: Mon, 31 Jul 2023 08:38:02 +0000 (+0900) Subject: doc: fix C++ example compilation on MinGW X-Git-Tag: 3.8.1~4^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=5db0db2e83da54d799f55984dc33039d6b22c933;p=thirdparty%2Fgnutls.git doc: fix C++ example compilation on MinGW The examples under doc/examples/ are compiled with Gnulib, which overrides write if it's not available, as a macro. This conflicts with the usage of std::iostream::write in ex-cxx.cpp. To avoid the build issue, use a custom namespace to hide it, as suggested in: https://www.gnu.org/software/gnulib/manual/html_node/A-C_002b_002b-namespace-for-gnulib.html Signed-off-by: Daiki Ueno --- diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index fafee946c4..690c3bb154 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -52,6 +52,10 @@ endif if ENABLE_CXX ex_cxx_SOURCES = ex-cxx.cpp ex_cxx_LDADD = $(CXX_LDADD) +# Gnulib overrides `write` as a macro if it's not available, which conflicts +# with `std::iostream::write`. Use a custom namespace to hide it: +# https://www.gnu.org/software/gnulib/manual/html_node/A-C_002b_002b-namespace-for-gnulib.html +ex_cxx_CPPFLAGS = $(AM_CPPFLAGS) -DGNULIB_NAMESPACE=gnulib noinst_PROGRAMS += ex-cxx endif