I’ve been seeing the following compiler error in the Particle Dev IDE, but from anywhere between 25-75% of the time:
(for searchability, it says “expected constructor, destructor, or type conversion before ‘(’ token”)
The line it is referencing just says SYSTEM_THREAD(ENABLED);.
I’m not sure why there is nondeterminism, but could it be that some servers in the build farm are building against an older version of the system firmware?
I’ve tried this from the CLI with a minimal example and have received the same results. Here’s two successive compilation attempts with no change in code between:
$ particle compile photon
Compiling code for photon
Including:
/Users/vishal/Workspace/sandbox/main.ino
attempting to compile firmware
pushing file: /Users/vishal/Workspace/sandbox/main.ino
Memory use:
text data bss dec hex filename
2892 8 352 3252 cb4 /spark/compile_service/shared/workspace/6_platform_6_20_8/firmware/7fd1ace8c670e631101f17b5ef25785b4ecc881f1fef3db752d557dacb8c/7fd1ace8c670e631101f17b5ef25785b4ecc881f1fef3db752d557dacb8c.elf
grabbing binary from: https://api.particle.io/v1/binaries/56705e87b843e8b270299b7b
Compile succeeded.
Saved firmware to: /Users/vishal/Workspace/sandbox/photon_firmware_1450204804194.bin
$ particle compile photon
Compiling code for photon
Including:
/Users/vishal/Workspace/sandbox/main.ino
attempting to compile firmware
pushing file: /Users/vishal/Workspace/sandbox/main.ino
Errors
main.cpp:2:14: error: expected constructor, destructor, or type conversion before '(' token
#include "application.h"
^
make[1]: *** [../build/target/user/platform-6main.o] Error 1
make: *** [user] Error 2
Compile failed. Exiting.
Here’s a minimal example to replicate the issue. Without SYSTEM_THREAD(ENABLED), this seems to compile fine 100% of the time.
The automatically selected firmware version in the Build IDE seems to be wrong right now. Force the selection to 0.4.7 instead of “Latest (0.4.7)” and it will compile.
Thanks for the response @jvanier, but I’m having this issue with Particle Dev and also particle-cli’s compile command. I’m not aware of a way to set the system firmware with either of those - are you?
I have experienced the same thing recently as well when SYSTEM_THREAD(ENABLED); was the first line of the code. Previously this never happened so something on the build farm has changed. For now I have just commented this line out until the issue is resolved.
Thanks for reporting this, I’ve identified the issue, a recent API update changed a behavior when picking the “latest” firmware target for your device. If you explicitly select the version “0.4.7” it should work properly. The update went out earlier this week (Mon/Tues), Sorry we didn’t catch this sooner!
edit: I’ve applied a small patch that should address this for the Photon, but not yet for the P1/ Core. We should have a better fix in place later this week.
Sorry about the delay on this! @suda just wrote up a fix for the issue, and we just finished deploying and testing it, so it should be working as expected again.
I am having an issue with SYSTEM_MODE(AUTOMATIC) and SYSTEM_THREAD(ENABLED) causing the same error noted above to occur. The error only occurs when in Particle DEV, it seems to work ok in the Web IDE. Any ideas on how to fix this error in Particle DEV?
I have downloaded the latest version of Particle Dev, and there is no change, its still not working. Even though the Web IDE does not have this issue, the code I have has many files, and it will be very difficult to organize on the Web IDE.
I’d really like to have this as soon as possible for an upcoming event.