[PATCH 05/13] manual: Fix missing include in memopen example.
Collin Funk
collin.funk1@gmail.com
Sun Sep 28 22:45:58 GMT 2025
Previously this file would fail to compile with the following error:
$ gcc manual/examples/memopen.c
manual/examples/memopen.c: In function ‘main’:
manual/examples/memopen.c:28:30: error: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
28 | stream = fmemopen (buffer, strlen (buffer), "r");
| ^~~~~~
manual/examples/memopen.c:19:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
18 | #include <stdio.h>
+++ |+#include <string.h>
19 |
manual/examples/memopen.c:28:30: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
28 | stream = fmemopen (buffer, strlen (buffer), "r");
| ^~~~~~
manual/examples/memopen.c:28:30: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
---
manual/examples/memopen.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/manual/examples/memopen.c b/manual/examples/memopen.c
index e87006dc45..8ef34fcbfa 100644
--- a/manual/examples/memopen.c
+++ b/manual/examples/memopen.c
@@ -16,6 +16,7 @@
*/
#include <stdio.h>
+#include <string.h>
static char buffer[] = "foobar";
--
2.51.0
More information about the Libc-alpha
mailing list