Hello Andreas, On Thu, 10 Jan 2019 at 08:16, Andreas Westfeld <andreas.westfeld@xxxxxxxxxxxxxx> wrote: > > No, please ignore, I did not get that I also have to include > <features.h> in order to define __USE_GNU via _GNU_SOURCE: > > #ifdef _GNU_SOURCE > # define __USE_GNU 1 > #endif No, it's not necessary to include that header. Rather, see the following text in http://man7.org/linux/man-pages/man7/feature_test_macros.7.html : NOTE: In order to be effective, a feature test macro must be defined before including *any* header files. This can be done either in the compilation command (cc -DMACRO=value) or by defining the macro within the source code before including any headers. Thanks, Michael > > On 09.01.19 20:07, Andreas Westfeld wrote: > >> SYNOPSIS > >> #define _GNU_SOURCE /* See feature_test_macros(7) */ > >> #include <string.h> > > > > should be > > > > SYNOPSIS > > #define __USE_GNU /* See feature_test_macros(7) */ > > #include <string.h> > > > > because <string.h> needs it for declaring memmem ... (see below). The > > same symbol replacement is necessary in man 3 mempcpy, strfry, > > memfrob, memchr and probably others. > > > > Andreas > > > > #ifdef __USE_GNU > > /* Find the first occurrence of NEEDLE in HAYSTACK. > > NEEDLE is NEEDLELEN bytes long; > > HAYSTACK is HAYSTACKLEN bytes long. */ > > extern void *memmem (const void *__haystack, size_t __haystacklen, > > const void *__needle, size_t __needlelen) > > __THROW __attribute_pure__ __nonnull ((1, 3)); -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/