Platformio didnt find strdup but compiled

I try make this for esp8266 framework Arduino.
Core 5.1.1 Home 3.3.4

char test[16]=“123123”;
char *temp_user = strdup(test);

идентификатор “strdup” не определенC/C++(20)

Did you #include <string.h>?

Ctrl+Shift-P → Rebuild Intellisense?

its not work. I have #include <string.h>

Weird, the declaration is within an ifdef block…

with __MISC_VISIBLE, __POSIX_VISIBLE etc. Those things are activated when the _GNU_SOURCE macro is defined.

You can add

build_flags = 
   -D _GNU_SOURCE

to the platformio.ini and reload intellisense

Then it should work.

1 Like

Thank you, you are the best. I reinstalled the program and this was not the case on the same project before. In this case, the compilation completes normally