[PATCH 01/13] manual: Fix missing include in group and user database example.

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Mon Sep 29 15:21:33 GMT 2025



On 28/09/25 23:45, Collin Funk wrote:
> Previously this file would fail to compile with the following error:
> 
>     $ gcc manual/examples/db.c
>     db.c: In function ‘main’:
>     db.c:37:7: error: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
>        37 |       printf ("Couldn't find out about user %d.\n", (int) me);
>           |       ^~~~~~
>     db.c:23:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
>        22 | #include <stdlib.h>
>       +++ |+#include <stdio.h>
>        23 |
>     db.c:37:7: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
>        37 |       printf ("Couldn't find out about user %d.\n", (int) me);
>           |       ^~~~~~
>     db.c:37:7: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
>     db.c:42:3: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
>        42 |   printf ("I am %s.\n", my_passwd->pw_gecos);
>           |   ^~~~~~
>     db.c:42:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

LGTM for this whole set, thanks!

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  manual/examples/db.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/manual/examples/db.c b/manual/examples/db.c
> index 7befca7968..5ded1ea8cd 100644
> --- a/manual/examples/db.c
> +++ b/manual/examples/db.c
> @@ -20,6 +20,7 @@
>  #include <sys/types.h>
>  #include <unistd.h>
>  #include <stdlib.h>
> +#include <stdio.h>
>  
>  int
>  main (void)



More information about the Libc-alpha mailing list