Hi, Miro Palmu via wrote: > g++ -DHAVE_CONFIG_H -I. -I.. -I./lib -I../lib -O0 -MT main.o -MD -MP > -MF .deps/main.Tpo -c -o main.o ../main.cpp > In file included from /usr/include/sys/un.h:38, > from ../main.cpp:4: > ./lib/string.h:829:1: error: conflicting declaration of ‘void* > memchr(void*, int, size_t)’ with ‘C’ linkage > 829 | _GL_CXXALIASWARN1 (memchr, void *, > | ^~~~~~~~~~~~~~~~~ > In file included from ./lib/string.h:41: > /usr/include/string.h:87:14: note: previous declaration with ‘C++’ linkage > 87 | extern void *memchr (void *__s, int __c, size_t __n) > | ^~~~~~
I don't reproduce this error, with your sample. But it is obviously related to the glibc bug https://sourceware.org/bugzilla/show_bug.cgi?id=32024 and gnulib has a workaround, in module 'sys_un-h'. 2025-01-11 Bruno Haible <br...@clisp.org> sys_un-h: Document the glibc bug. Reported by Miro Palmu <em...@miropalmu.cc> in <https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00077.html>. * doc/posix-headers/sys_un.texi: Mention the glibc bug. diff --git a/doc/posix-headers/sys_un.texi b/doc/posix-headers/sys_un.texi index 338f5826c8..9eec7af31e 100644 --- a/doc/posix-headers/sys_un.texi +++ b/doc/posix-headers/sys_un.texi @@ -17,6 +17,10 @@ @item This header file does not define the @code{sa_family_t} type on some platforms: Cygwin 3.5.5, mingw, MSVC 14. +@item +This header file causes compilation errors in C++ mode on some platforms: +@c https://sourceware.org/bugzilla/show_bug.cgi?id=32024 +glibc 2.40. @end itemize Portability problems not fixed by Gnulib: