Modbus master arduino code is throwing weird errors on upload
Your issue is that you define constants, such as timeout, which are widely used in Arduino library as parameter names. After preprocessing your definitions, correct code in "Arduino.h" such as

unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);


becomes

unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long 1000);


No wonder the latter line fails to compile.

You will need to find unique names for your defines, or use constant variables instead.