pubsubclient icon indicating copy to clipboard operation
pubsubclient copied to clipboard

identifier "strnlen" is undefined on VSCode PlatformIO

Open jiyi27 opened this issue 3 years ago • 2 comments

I have install this library, and compiled my project successfully, but I am wondering why have this issue in PubSubClient.cpp? [{ "resource": "/C:/qwer/.pio/libdeps/esp12e/PubSubClient/src/PubSubClient.cpp", "message": "identifier "strnlen" is undefined", "source": "C/C++", "startLineNumber": 235, }]

jiyi27 avatar Mar 06 '22 01:03 jiyi27

#include <string.h>

or paste this

size_t strnlen (const char *, size_t);

IronBamBam1990 avatar Apr 21 '22 07:04 IronBamBam1990

Mine works by Configuring the IntelliSense for C/C++ at Compiler Arguments and adding the compiler flag below.

I add the same problem and I found out that using -std=gnu++11 compiler flag solves it.

JamesDelfini avatar Jan 15 '23 10:01 JamesDelfini