Is anyone else experiencing issues with compiling. I have code which was compiling fine and now won’t. I have been working through it and it seems comments are causing problems for the compiler. So I don’t bore you with unnecessary code see the simple examples below. This first one compiles fine
That is a known issue of the Particle Wiring preprocessor.
You can try to add another blank line before/after the comment or just ditch the preprocessor completely via
#pragma SPARK_NO_PREPROCESSOR
#include "Particle.h"
// add function prototypes/forward declarations where needed
junk.cpp: In function 'void setup()':
junk.cpp:8:31: error: 'test' was not declared in this scope
make[1]: *** [../build/target/user/platform-6junk.o] Error 1
make: *** [user] Error 2
It has only come about today on code which was working before. Can you get the examples above to compile?
Once you have the no preprocessor pragma in place, you must abide by normal C/C++ rules, including the order of functions or using function prototypes.
In this case, you need to move the function test above the function setup() so it will be defined before you try to use it in the Particle.function call.