V0.6.2 compile errors

Just did a git pull on my firmware folder to update to v0.6.2. I ran make all on the repo after the pull and everything compiled fine but when i tried building with my application firmware i get the following compile errors

In file included from c:\users\ali\documents\src\commercial\library\drivers\relay\relay.h:14:0,
                 from C:/Users/Ali/Documents/src/Commercial/Library/Devices/device.h:11,
                 from C:/Users/Ali/Documents/src/Commercial/Library/Devices/device.cpp:8:
../wiring/inc/spark_wiring_arduino_constants.h:40:21: error: expected identifier before numeric constant
 #define DEFAULT     1
                     ^
../system/inc/system_mode.h:30:3: note: in expansion of macro 'DEFAULT'
   DEFAULT=0, AUTOMATIC = 1, SEMI_AUTOMATIC = 2, MANUAL = 3, SAFE_MODE=4
   ^
../wiring/inc/spark_wiring_arduino_constants.h:40:21: error: expected '}' before numeric constant
 #define DEFAULT     1
                     ^
../system/inc/system_mode.h:30:3: note: in expansion of macro 'DEFAULT'
   DEFAULT=0, AUTOMATIC = 1, SEMI_AUTOMATIC = 2, MANUAL = 3, SAFE_MODE=4
   ^
../wiring/inc/spark_wiring_arduino_constants.h:40:21: error: expected unqualified-id before numeric constant
 #define DEFAULT     1
                     ^
../system/inc/system_mode.h:30:3: note: in expansion of macro 'DEFAULT'
   DEFAULT=0, AUTOMATIC = 1, SEMI_AUTOMATIC = 2, MANUAL = 3, SAFE_MODE=4
   ^
In file included from ../wiring/inc/spark_wiring_system.h:29:0,
                 from ../wiring/inc/spark_wiring.h:46,
                 from ./inc/../../../firmware/user/inc/application.h:40,
                 from ./inc/../../../firmware/user/inc/Particle.h:5,
                 from c:\users\ali\documents\src\commercial\library\drivers\relay\relay.h:16,
                 from C:/Users/Ali/Documents/src/Commercial/Library/Devices/device.h:11,
                 from C:/Users/Ali/Documents/src/Commercial/Library/Devices/device.cpp:8:
../system/inc/system_mode.h:31:3: error: 'System_Mode_TypeDef' does not name a type
 } System_Mode_TypeDef;
   ^
../system/inc/system_mode.h:33:22: error: variable or field 'set_system_mode' declared void
 void set_system_mode(System_Mode_TypeDef mode);
                      ^
../system/inc/system_mode.h:33:22: error: 'System_Mode_TypeDef' was not declared in this scope
../system/inc/system_mode.h:34:1: error: 'System_Mode_TypeDef' does not name a type
 System_Mode_TypeDef system_mode();
 ^
../system/inc/system_mode.h:51:1: error: expected declaration before '}' token

The error seems like a #define conflict. Anyone has suggestions to fix this?

@Ali, are you defining DEFAULT in your code as this seems to be the root of the error.

I actually do not use any #defines. I prefer using C++ style constants or enums.
I am using this macro in one of my drivers

bitWrite(reg,pin,setting);

need to add

#include "spark_wiring_arduino_constants.h"

to make it work. But as soon as i do this it stops to compile. Commenting out bitwrite solves the issue.

@Ali, instead of adding #include "spark_wiring_arduino_constants.h", add #include "Arduino.h" instead, before anything else to see if that works.

Yes that solved it. Thank you!

1 Like