'Particle' was not declared in this scope

I am using the Web IDE to compile two previously working Particle Core applications and I get the “‘Particle’ was not declared in this scope” error with the line number pointing at a “Particle.publish” function.

This is unchanged and previously worked.

Reverting back to “Spark.publish” removes the errors, has something changed in the Web IDE or the firmware compiler?

2 Likes

Have you checked which firmware version you are targeting?

The “latest” 0.4.7

This is very odd, but try to select “0.4.7” (not “Latest (0.4.7)”)

1 Like

You got it! Selecting 0.4.7 compiles the code no problem. Selecting “Latest 0.4.7” generate the “Particle was not declared in this scope” error.

Quirky to say the least.

I’m filing an issue right now

3 Likes

@ScruffR Thanks for this spot. Last night the Web IDE compile was throwing all sorts of weird errors until I set to 0.4.7 as you suggested.

I can confirm this! Suddenly starts popping up these compile errors.

Can anyone explain how/where to switch target versions?

The target icon in the bottom left corner of Web IDE is the place
https://docs.particle.io/guide/getting-started/build/photon/#wait-what-is-firmware-

1 Like

Is there any way to switch target versions on particle dev? I’ve got a bout 25 files in my project and not keen on porting them all to web ide?

@Moookeee, unfortunately not.
If you are targeting a Core you could try building over and over till you hit a build server that still or already works again.
And for Photons the issue should have disappeared already.

Bumping this thread because I’m having the same problem, still.

particle_variable_test.cpp:9:3: error: ‘Particle’ was not declared in this scope
String aString;
^

Flashing a Photon. Tried building with 0.4.7 and latest 0.4.7. Bonks every time. Used to work. Anybody got anything to try? Thanks all.

Ok…now it’s working. So that’s good.

Thanks for listening!!