Error size of unamed array is negative - zephyr/sys/util.h

Hello !
I am very new to PlatformIO and Zephyr. I am trying to debug a DHT Sample project, which is available from Zephyr. I am getting an error #define ZERO_OR_COMPILE_ERROR(cond) ((int) sizeof(char[1 - 2 * !(cond)]) - 1)

.platformio\packages\framework-zephyr\include/zephyr/sys/util.h:94:55: error: size of unnamed array is negative
94 | #define ZERO_OR_COMPILE_ERROR(cond) ((int) sizeof(char[1 - 2 * !(cond)]) - 1)

The Error is generated on the macro - DEVICE_DT_GET_ONE(aosong)

Any solution or if any workarounds ?

Thank you for your support.
Rohan

Well if DEVICE_DT_GET_ONE(aosong) throws an error you might have not correctly used a board overlay to tell Zephyr at which pin (the data pin) the DHT22 can be found. Looking at https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/sensor/dht/boards/nrf52dk_nrf52832.overlay that’s at least how they do it.

Also see docs https://docs.zephyrproject.org/latest/build/dts/api/bindings/sensor/aosong,dht.html

Thank you for the reply. Unfortunately the error is only encountered on DEVICE_DT_GET_ONE().
For others such as, DEVICE_DT_GET_ANY() or DEVICE_DT_GET_OR_NULL() there is no error. I am not sure why is it such. Is it something to do with Zephyr + PlatformIO integration ?

I checked the DHT Example, and changed as per the example, but the Error still persists.

Thanks !

What is your current platformio.ini and Zephyr config files?