The example code of ArduinoModbus Fails to compile on the RAK4631, even though its listed here: [WisBlock/examples/RAK4630/IO/RAK5802_RS485 at master · RAKWireless/WisBlock · GitHub as](WisBlock/examples/RAK4630/IO/RAK5802_RS485 at master · RAKWireless/WisBlock · GitHub as) required library.
The output in Arduino IDE is as follows (anonymized some paths):
WARNING: Library ArduinoRS485 claims to run on samd, mbed_portenta, mbed_opta architecture(s) and may be incompatible with your current board, which runs on nrf52 architecture(s).
WARNING: Library ArduinoModbus claims to run on megaavr, samd, mbed_nano, mbed_portenta, mbed_opta architecture(s) and may be incompatible with your current board, which runs on nrf52 architecture(s).
In file included from C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/Arduino.h:1,
from C:\Users[UserPath]\Documents\Arduino\libraries\ArduinoModbus\src\libmodbus\modbus.c:23:
C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/[HeaderFile].h:67:11: error: expected '=', ',', ';', 'asm' or 'attribute' before '<' token
67 | template<class T, class L>
| ^
C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/[HeaderFile].h:73:11: error: expected '=', ',', ';', 'asm' or 'attribute' before '<' token
73 | template<class T, class L>
| ^
C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/[HeaderFile].h:319:6: error: conflicting types for 'random'
319 | long random(long max);
| ^~~~~~
In file included from C:\Users[UserPath]\Documents\Arduino\libraries\ArduinoModbus\src\libmodbus\modbus.c:13:
c:\users[UserPath]\packages[Hardware1]\tools[Compiler][Version]\arm-none-eabi\include\stdlib.h:255:6: note: previous declaration of 'random' was here
255 | long random (void);
| ^~~~~~
In file included from C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/Arduino.h:1,
from C:\Users[UserPath]\Documents\Arduino\libraries\ArduinoModbus\src\libmodbus\modbus.c:23:
C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/[HeaderFile].h:350:6: error: conflicting types for 'random'
350 | long random(long min, long max);
| ^~~~~~
In file included from C:\Users[UserPath]\Documents\Arduino\libraries\ArduinoModbus\src\libmodbus\modbus.c:13:
c:\users[UserPath]\packages[Hardware1]\tools[Compiler][Version]\arm-none-eabi\include\stdlib.h:255:6: note: previous declaration of 'random' was here
255 | long random (void);
| ^~~~~~
In file included from C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/Arduino.h:1,
from C:\Users[UserPath]\Documents\Arduino\libraries\ArduinoModbus\src\libmodbus\modbus.c:23:
C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/[HeaderFile].h:653:62: error: expected ';', ',' or ')' before '=' token
653 | void tone(uint8_t pin, uint32_t frequency, uint64_t duration = 0);
| ^
C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/[HeaderFile].h:767:73: error: expected ';', ',' or ')' before '=' token
767 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
| ^
C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/[HeaderFile].h:783:77: error: expected ';', ',' or ')' before '=' token
783 | unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
| ^
In file included from C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/[HeaderFile].h:917,
from C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/Arduino.h:1,
from C:\Users[UserPath]\Documents\Arduino\libraries\ArduinoModbus\src\libmodbus\modbus.c:23:
C:\Users[UserPath]\packages[Hardware1]\hardware\nrf52[Version]/cores/nRF5/component/[API_Name]/WString.h:4:10: fatal error: cstdlib: No such file or directory
4 | #include <cstdlib>
| ^~~~~~~~~
compilation terminated.
exit status 1
Error compiling for the board [BoardName].