Is anybody familiar with below error on compiling code for esp32 based on arduino framework in platformio ?
identifier “setenv” is undefined
identifier “tzset” is undefined
I am working on an ubuntu machine. It appears setenv is part of stdlib.h and tzset is part of time.h. But i think the arduino framework libraries are not having these. These appear to be part of regular c/c++ libraries which am not sure if my program compilation is seeing them ?
For arduino framework to support it, does some special libraries needs to be installed ? How ?
Can i use the external gcc c/c++ library paths into this esp32 project ? How ?
does compile and is advertised to work by the underlying ESP-IDF layer.
There is just an Intellisense error, which comes from the fact that there are multiple time.h files in the include path of the compiler and that a macro is set which comments out the definition of those functions.
Same for setenv()
And __STRICT_ANSI__ is defined by the compiler in the Intellisense, but obviously the /tools/sdk/lib/libc_nano.a contains the definitions so it was compiled without the strict ANSI.
Not sure how to put the compiler during Intellisense into the mode so that __STRICT_ANSI__ is not defined and these extended functions are compiled in. If you just want to get rid of the Intellisense errors you can copy-paste the declaration on top of the sketch.
#include <Arduino.h>
_VOID _EXFUN(tzset, (_VOID));
int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite));
I used exactly this solution in my Arduino / ESP8266 project about a year ago thanks. However, now when I come to open the source code again, ironically, I see Intellisense errors.
25 | #include <Adafruit_I2CDevice.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\nodemcuv2\lib3b7\RTClib\RTC_PCF8523.cpp.o] Error 1
src\main.cpp:18:1: error: ‘_VOID’ does not name a type
18 | _VOID _EXFUN(tzset, (_VOID));
| ^~~~~
src\main.cpp:19:20: error: expected primary-expression before ‘const’
19 | int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite));
| ^~~~~
src\main.cpp:19:20: error: expected ‘)’ before ‘const’
19 | int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite));
| ~^~~~~
| )
In file included from C:\Users\netdu.platformio\lib\RTClib\src\RTC_DS1307.cpp:1:
C:\Users\netdu.platformio\lib\RTClib\src\RTClib.h:25:10: fatal error: Adafruit_I2CDevice.h: No such file or directory
I found this article and managed to get the code to compile further after I used the suggested option to add the Adafruit Bus IO library into the project.
I still get the below errors though -
src\main.cpp:18:1: error: ‘_VOID’ does not name a type
18 | _VOID _EXFUN(tzset, (_VOID));
| ^~~~~
src\main.cpp:19:20: error: expected primary-expression before ‘const’
19 | int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite));
| ^~~~~
src\main.cpp:19:20: error: expected ‘)’ before ‘const’
As it happens, you previously helped someone else with the same Adafruit issue