# \[SOLVED\] Particle DEV Compile Errors with SYSTEM\_THREAD(ENABLED) and SYSTEM\_MODE(AUTOMATIC)

**URL:** <https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544>\
**Category:** Troubleshooting\
**Created:** [March 15, 2017, 4:56pm UTC](https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544 "2017-03-15T16:56:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam42](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/adam42/32/24687_2.png) [@Adam42](https://community.particle.io/u/Adam42)\
**Post date:** [March 15, 2017, 4:56pm UTC](https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544/1 "2017-03-15T16:56:34Z")

</div>

Hello Particle Forum,

Yesterday my code on particle dev that was previously working began giving a strange compile error. It goes away when I comment out the top lines of my code.

Compile Error:

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/6/66023a18bd668c07f1bb72008e9b0d530b56a11f.png)

Commenting out this part removes the compile error:  
 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/f/f6f7ef535a25c2172f8b5eecd4fd0989023b7544.png)

What I have tried.

My device target is set to 6.1 in Particle Build, and the device is running 6.1.  
I re-installed with the latest Particle Dev from particle website.

Other than those checks I’m stuck on what to do. These commands work just fine on the web IDE however, the program I have currently is very large with multiple files and trying to get in to web IDE would be very difficult.

This error was not showing up until 3/14/17. On 3/11/18 It compiled without error.

Is anyone else experiencing difficulty with Particle Dev and System\_Thread() and System\_Mode() ?

---

<div class="post-metadata">

**Author:** ![nrobinson2000](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/nrobinson2000/32/15624_2.png) [@nrobinson2000](https://community.particle.io/u/nrobinson2000)\
**Post date:** [March 15, 2017, 5:08pm UTC](https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544/2 "2017-03-15T17:08:57Z")

</div>

Do you get the same error when building your project with particle-cli?

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [March 15, 2017, 5:23pm UTC](https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544/3 "2017-03-15T17:23:06Z")

</div>

This might have something to do with a recent update to the Wiring preprocessor.  
Can you try swapping around `SYSTEM_MODE()` and `SYSTEM_THREAD()`, adding/removing blank lines before/after, remove the semicolon after the instructions.

What are the next few instructions?

---

<div class="post-metadata">

**Author:** ![Adam42](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/adam42/32/24687_2.png) [@Adam42](https://community.particle.io/u/Adam42)\
**Post date:** [March 16, 2017, 12:47am UTC](https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544/4 "2017-03-16T00:47:50Z")

</div>

Hi nrobinson2000,

I tried with compiling with Particle CLI and got the same error as before. I thought that was a good idea.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/0/0a2c524632e394c44592cd14ce67c95aae5359fe.png)

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/e/ea742f9233be756ea638a7c4d3b034f508cb55e6.png)

Hi ScruffR,

I tried reversing the order of the commands, as well as removing the spaces, and that did not change the error.

I do get something different when I remove the semi-colon of the one above. It seems to only color in the lower command (SYSTEM\_MODE in this case) when there is a semi colon.

![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/9/90e10893334e547d72b4b544b9dd73150df6471a.png)

![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/3/31c83486d307ce1958374d96d527c20626bc3936.png)

The rest of the code prior to setup is a series of include statements for other library files I would like to use.

```
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(AUTOMATIC);

#include "CanUart.h"
#include "DebugLevel.h"
#include "SDLogger.h"
//#include "GPSWrap.h"
#include "Motor.h"
#include "Behavior.h"
#include "Led.h"
#include "Buzzer.h"
#include "Particle.h"
#include "UbidotsValue.h"
#define DEBUG_BAUDRATE 115200

void setup(){

```

I’m just really not sure why it has stopped working from this past Sunday.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [March 16, 2017, 6:12am UTC](https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544/5 "2017-03-16T06:12:09Z")

</div>

> [@Adam42](#):
>
> I'm just really not sure why it has stopped working from this past Sunday.

As I said, it might be in conjunction with this

> [@\[SOLVED\] Preprocessor issue with cloud compiler](https://community.particle.io/t/solved-preprocessor-issue-with-cloud-compiler/30204/6):
>
> The fix rolled out to all cloud compiler targets on March 14, 2017. For more information about the preprocessor, see the documentation here: [https://docs.particle.io/reference/firmware/#preprocessor](https://docs.particle.io/reference/firmware/#preprocessor)

You can also try

```cpp
#praga SPARK_NO_PREPROCESSOR
#include <Particle.h>

```

and add function prototype for your functions in the main project file.

Maybe this is also something @jvanier wants to chime in on in connection with the possible impact of his bug-fix.

---

<div class="post-metadata">

**Author:** ![Adam42](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/adam42/32/24687_2.png) [@Adam42](https://community.particle.io/u/Adam42)\
**Post date:** [March 16, 2017, 4:58pm UTC](https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544/6 "2017-03-16T16:58:07Z")

</div>

Hi ScruffR,

Thank you for the suggestions,

Where can I get more information on this tip though, I'm not sure what you are saying to do.

> add function prototype for your functions in the main project file

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [March 16, 2017, 5:02pm UTC](https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544/7 "2017-03-16T17:02:26Z")

</div>

That’s a common C/C++ term

> **[Function prototype](https://en.wikipedia.org/wiki/Function_prototype)**
>
> In computer programming, a function prototype or function interface is a declaration of a function that specifies the function's name and type signature (arity, data types of parameters, and return type), but omits the function body. While a function definition specifies how the function does what it does (the "implementation"), a function prototype merely specifies its interface, i.e. what data types go in and come out of it. The term function prototype is particularly used in the context of the...

---

<div class="post-metadata">

**Author:** ![Adam42](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/adam42/32/24687_2.png) [@Adam42](https://community.particle.io/u/Adam42)\
**Post date:** [March 16, 2017, 6:07pm UTC](https://community.particle.io/t/solved-particle-dev-compile-errors-with-system-thread-enabled-and-system-mode-automatic/30544/8 "2017-03-16T18:07:35Z")

</div>

Hi ScruffR,

Thanks for the info on the Function Prototypes.

everything is working now.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/4/4535ba8b4e750f874230e854ec0d0a225ef9f2d1.png)
