I have a rather trivial project and decided to use an old Core that I had purchased some time ago. When I try to compile with 052, I sometimes get a message saying that it could not compile, but no details. I then try to compile with 049 and the compiler goes just fine. Sometimes, I can go back to 052 after compiling with 049 and then 052 compiles fine as well. All successful compiles result in working software on the Core after I flash it. I have not tried to compile with other versions, only 049 and 052. So there isn’t any compatibility problem with my software and 052, but compilation is not reliable. I am using 049 as the baseline because this was the last system firmware version that I have used successfully with Core, Photon and Electron.
I am using the web IDE to compile. Does anyone know what’s up?
As it seems, your use of VERSION is not liked by the compiler.
I also see your error, but when changing VERSION to _VERSION the build never fails again.
@ScruffR: Thanks for looking at this. If I understand this correctly, _VERSION is a predefined constant that returns the version of the Particle firmware, or some such thing. VERSION (without the underscore) should not be system defined. I have defined it as: const String VERSION = “1.0”; I use this with a Particle.variable() declaration so that I can read out the version of my software from a device in the field (for troubleshooting purposes). It should not cause any compilation problem.
In any event, I think there is some other problem with using 052 to compile software for a Core (Photon seems OK, but the inconsistent nature of the failure makes if hard to say with certainty.) I believe this because:
compilation seems to always work with system firmware 049.
compilation sometimes works and sometimes fails with the exact same software when trying to compile with 052.
when compilation fails, the message only says “failed to compile”. There are no details presented about what the compiler is complaining about. If I had attempted to redefine a system defined constant, the compiler would certainly give an error message to the effect.
as stated above, I believe that the same code ALWAYS compiles OK for Photon. Given the aforementioned disclaimer about non-repeatability, it would seem to be some Core related issue. Perhaps 052 misses to link in some system library for Core and when you go compile with 049 the library gets loaded into the linker and then if you go back and recompile with 052 there is no longer a problem. Just speculating, anyway.
When you said that your change worked, did you test this with Core or with a Photon?
Nope, rather the other way round.
You could use any variable name butVERSION. Try using vers or Version - this should also build (does with me).
BTW, all capital names are often used for #define macros, so it’s always safer to stay clear of using them.
And I tested with Core as target and for me it always (10~15 times) failed with VERSION.
It’s still an odd phenomenon.
Maybe @Dave could look at.
I’ve just tried to build with CLI - to gett better error output -, but there I also got intermitent results.
I also tried #pragma SPARK_NO_PREPROCESSOR but that didn’t cure it either.
I tried changing the name to; const String VER = “1.0”; I got the same compile error (no details). I did nothing else at all by try to compile the same code again, and it worked. This is with system 052 and a Core. So changing the variable name does nor work but retrying compilation does work. It must be some sort of precompile/build issue.
I see you had those issues on the 29th. It looks like one of our compile servers was down then and because we load balance traffic between them, each time you were directed to the box which was down you got this error. But this issue should be resolved now.