]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
doc: fix C++ example compilation on MinGW
authorDaiki Ueno <ueno@gnu.org>
Mon, 31 Jul 2023 08:38:02 +0000 (17:38 +0900)
committerDaiki Ueno <ueno@gnu.org>
Mon, 31 Jul 2023 09:44:27 +0000 (18:44 +0900)
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 <ueno@gnu.org>
doc/examples/Makefile.am

index fafee946c4bebb12869edb1fc0a606d6a0e7b95c..690c3bb154c0978cab14ad0d34ca1b906d22a909 100644 (file)
@@ -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