This message appears on the online editor when I add a Modbus master using ArduinoRS485 and ArduinoModbus (in a special version called "_S" for the online editor, since it detects conflicts between ArduinoIot and ArduinoModbus about "On" and "Off" definitions.) on a Portenta H7 with breakout board.
The full description is :
In file included from /home/builder/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1/variants/PORTENTA_H7_M7/pinmode_arduino.h:30:0,
from /home/builder/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1/cores/arduino/Arduino.h:26,
from /mnt/create-efs/webide/6b/09/6b0945c459af72e04d2dbdea10cd4771:i_diallo/libraries_v2/ArduinoModbus_S/src/libmodbus/modbus.c:22:
/home/builder/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1/cores/arduino/api/Common.h:75:9: error: unknown type name 'bool'
typedef bool boolean;
^~~~
Error during build: exit status 1
By the way, not one of the booleans declared in the code uses "bool" as a declarant instead of "boolean".
That works fine with C++ code, but the modbus.c file is compiled as C, and something is missing for it to work with C:
In C99 the native type is actually called _Bool , while bool is a standard library macro defined in stdbool.h
This means that C code which has an #include directive for Arduino.h must first #include the file stdbool.h.
This was done in the latest release of the official ArduinoModbus library:
So I suspect that either the ArduinoModbus_S has not yet pulled in that change from the upstream library, or else you are using an outdated version of ArduinoModbus_S.
Thanks for your answer,
but I just had a look at both ArduinoModbus libraries (standard, and _S) I on the online IDE, and Stdbool.h is included in both just where the fix build mentionned, so I do not think this would be the problem.
I am currently working on using SimpleModbusMaster_DUE to work around the problem.
By the way, ArduinoModbus_S is the ArduinoModbus I had to modify to avoid some issues with a redefinition of "ON" and "OFF" somewhere in ArduinoIoT.
What ticks me off is this occurs only on the online IDE. Using 1.8.16 IDE offline, the same code loads like a breeze. And since I am running Windows, I cannot load ArduinoIoT programs (length of pathes known problem - should be solved in version 2).