[FIXED] PRODUCT_ID, PRODUCT_VERSION, SYSTEM_THREAD, SYSTEM_MODE in Workbench

So, I’m on a new project, and after using Particle IDE for years, I decided to give the Workbench a try.

Unfortunately, the PRODUCT_ID, PRODUCT_VERSION, SYSTEM_THREAD, and SYSTEM_MODE macros don’t seem to work (local compilation)… Any clue?

<command-line>:0:12: error: expected unqualified-id before numeric constant
/Users/phil/dev/cloudscent/src/cloudscent.ino:10:1: note: in expansion of macro 'PRODUCT_ID'
 PRODUCT_ID(10336);
 ^
/Users/phil/dev/cloudscent/src/cloudscent.ino:11:16: error: expected constructor, destructor, or type conversion before '(' token
 PRODUCT_VERSION(00100);
                ^
/Users/phil/dev/cloudscent/src/cloudscent.ino:12:14: error: expected constructor, destructor, or type conversion before '(' token
 SYSTEM_THREAD(ENABLED);
              ^
/Users/phil/dev/cloudscent/src/cloudscent.ino:13:12: error: expected constructor, destructor, or type conversion before '(' token
 SYSTEM_MODE(AUTOMATIC);
            ^
make[3]: *** [../build/target/user/platform-6-m/cloudscent/src/cloudscent.o] Error 1
make[2]: *** [user] Error 2

OK, it seems I fixed it.

Just added

#include "Particle.h"
#include "application.h"

before the macros. It compiled. Eureka!
(can’t remember doing this in Particle IDE and using the Particle-CLI though…)

you shouldn’t need to add headers when using an .ino main file.

if you provide the additional info listed here :point_right: How to report bugs and provide feedback i’d love to take a look :+1:

1 Like

Just as side note, since @m_m already addressed the main point: application.h was superseded by Particle.h so even if you needed the include in a .cpp or .h file it would only be #include <Particle.h>

2 Likes

Dev Code Studio has been acting strange since I started using it. Like clicking on the methods to go to the declaration or the header files is sometimes taking forever… I’m thinking of reinstalling the whole package… Side note I had Platform.io extension installed too, and it may be conflicting with Particle’s (at least it’s conflicting with the Arduino extension)

Good to know, thanks. Always wondered… But application.h is still required if main file is a .cpp, no?

Nope, application.h and Particle.h are more or less the same thing but Particle.h is the “new” version that should replace application.h (which should be deprecated IMO).