mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
apps/system/microros: add rcutils strcasecmp strings.h include patch.
POSIX specifies strcasecmp/strncasecmp in <strings.h>, not <string.h>. On NuttX (and other strict POSIX environments) rcutils/src/strcasecmp.c only includes <string.h>, causing an implicit-declaration error for strcasecmp when cross-compiling. Patch 0003 adds #include <strings.h> guarded by !_WIN32, matching the existing Windows/POSIX split in the file. Signed-off-by: Arjav Patel <arjav1528@gmail.com>
This commit is contained in:
parent
55a7d4d2df
commit
939ed0ca2a
1 changed files with 19 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
From: micro-ROS NuttX Port <noreply@nuttx.apache.org>
|
||||
Subject: [PATCH] rcutils: include <strings.h> for strcasecmp on NuttX
|
||||
|
||||
POSIX specifies strcasecmp/strncasecmp in <strings.h>, not <string.h>.
|
||||
NuttX follows the standard strictly so omitting this header causes an
|
||||
"implicit declaration" error. Guard the include with __NuttX__ so it
|
||||
only applies where needed and does not affect Linux or other platforms
|
||||
that already expose strcasecmp through <string.h>.
|
||||
|
||||
--- a/rcutils/src/strcasecmp.c
|
||||
+++ b/rcutils/src/strcasecmp.c
|
||||
@@ -17,6 +17,9 @@ extern "C"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
+#ifdef __NuttX__
|
||||
+#include <strings.h>
|
||||
+#endif
|
||||
|
||||
#include "rcutils/strcasecmp.h"
|
||||
Loading…
Add table
Add a link
Reference in a new issue