Hi there,
I am trying to use the memmem function from newlib, but I'm getting "error: implicit declaration of function 'memmem'", despite including "string.h".
I can see code for memmem in the newlib code for the esp32...is it for some reason not included in the IDF?
I imagine there is some silly reason I'm missing...would appreciate guidance.
Running IDF V3.0 release (2018-05-16)
Thank you!
ESP32 memmem?
Re: ESP32 memmem?
Hi caseymdk, I know this is an old thread, but in case any one else has the same issue:
memmem is a GNU extension. You need to define a feature test macro: _GNU_SOURCE.
It must be defined before any standard headers have been included.
For example:
memmem is a GNU extension. You need to define a feature test macro: _GNU_SOURCE.
It must be defined before any standard headers have been included.
For example:
- #define _GNU_SOURCE
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- char* p = memmmem(foo, foo_sz, bar, bar_sz); // You can now use memmem
Re: ESP32 memmem?
I appended this to component.mk to use memmem:
Code: Select all
#used for memmem
CFLAGS += -D__GNU_VISIBLE
Who is online
Users browsing this forum: Baidu [Spider] and 159 guests