The following simple function compiles for Photon without error with Particle CLI command:
>particle compile electron tst.cpp
_____________________________________________________________
Compiling code for electron
Including:
tst.cpp
attempting to compile firmware
pushing file: tst.cpp
downloading binary from: /v1/binaries/57029ced1ea673711e910b3f
saving to: p_firmware_1459789034442.bin
Memory use:
text data bss dec hex filename
2444 8 344 2796 aec /spark/compile_service/shared/workspace/
6_platform_6_24_1/firmware/978e231b66cc4872af9fd0b6c49ebe26c67305d760cbc6446c875
b983bd1/978e231b66cc4872af9fd0b6c49ebe26c67305d760cbc6446c875b983bd1.elf
_____________________________________________________________
Point it to an Electron, and it fails:
_____________________________________________________________
>particle compile electron tst.cpp
Compiling code for electron
Including:
tst.cpp
attempting to compile firmware
pushing file: tst.cpp
Compile failed. Exiting.
tst.cpp: In function 'void tst(char*)':
tst.cpp:5:24: error: 'SINGLE_THREADED_BLOCK' was not declared in this scope
SINGLE_THREADED_BLOCK()
^
tst.cpp:6:3: error: expected ';' before '{' token
{
^
make[1]: *** [../build/target/user/platform-10tst.o] Error 1
make: *** [user] Error 2
_____________________________________________________________
tst.cpp
#include "Particle.h" // Particle headers
void tst(char *str)
{
SINGLE_THREADED_BLOCK()
{
Serial.println(str);
}
}