# Spark Dev will not compile

**URL:** <https://community.particle.io/t/spark-dev-will-not-compile/11759>\
**Category:** Troubleshooting\
**Created:** [May 13, 2015, 1:14pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759 "2015-05-13T13:14:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 13, 2015, 1:14pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/1 "2015-05-13T13:14:49Z")

</div>

I had a problem with Spark Dev compelling once then doing absolutely nothing when I hit the compile check symbol. It did not provide error messages or compile. It was mute. Digging around and experimenting I thought I had solved the problem by ensuring that the program file was in its own like-named directory and with no other files.

It would have been nice to get error messages, but that requirement was in the docs, so…

After organizing the files/directories I was able to do compiles (last night). Now, this morning, even with the program file in its own folder I am back to the same behavior. It compiled once, then will not compile again. It just does nothing when I hit the compile “check” symbol.

Frustrating both that its happening and that I have no idea why.

---

<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:** [May 13, 2015, 1:32pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/2 "2015-05-13T13:32:22Z")

</div>

Have you checked if your internet connection is up and running?

Since the compile takes place in the cloud this is crucial for it to work.  
If your inet was gone and you tried to compile there and then, you might have to shut down and restart Spark Dev.

It has before also proved useful for us to have a full screenshot of your Spark Dev, to visually get clues about possible issues just by looking at it.

---

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 13, 2015, 2:48pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/3 "2015-05-13T14:48:31Z")

</div>

The internet is up and running. It has to be for me to post 😄 I can also select the spark device which is not connected to this computer via USB, and see it pulsing blue, so that encourages me to conclude the internet is up.

Attached is the screen shot. It has a small program that I’m just adding a Spark.function to. It is not done so probably has coding errors. Hitting the compile button does not change anything you see in the screen shot. No messages appear. Nothing. Let me know if you see something.

![](https://sea2.discourse-cdn.com/flex026/uploads/particle/5338/a06062254d91edd8.png)

---

<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:** [May 13, 2015, 3:48pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/4 "2015-05-13T15:48:31Z")

</div>

Nope, can't see any reason why it wouldn't work 😳

But that's not that much of a proof 😉

> [@Bendrix](#):
>
> The internet is up and running. It has to be for me to post

SInce I'm in Europe and you wrote of _this morning_, I assumed you did post a while after you experienced the problems - completely ignoring that you might live in a different time zone 😉

On the other hand, just to make sure - you have already shut down and restarted your Spark Dev.  
If you still have got the same issue, you might want to try compiling via CLI, just to confirm that you do have connection to the "compile in cloud" bit of the Spark infrastructure.

---

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 13, 2015, 7:53pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/5 "2015-05-13T19:53:12Z")

</div>

Got a message from Spark saying they are releasing an updated Spark Dev today, and to use an older version for now. Spark has confirmed the problem.

---

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 18, 2015, 4:22pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/6 "2015-05-18T16:22:56Z")

</div>

Monday, 5 / 18 at noon. Sorry to report, the update, if it was posted, did not resolve my problem. I get one partial compile, (compile in progress but no success message), then after that no activity at all in response to my click of the compile button. Here is the code. Very short, very simple. I know it has errors. I know it has errors. I’m not looking to have the errors reported in a reply. The Dev should flag those, not be mute…

Anyone else want to try compiling this code with TODAY’s version of Particle Dev?

---

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 18, 2015, 4:23pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/7 "2015-05-18T16:23:11Z")

</div>

Anyone else want to try compiling this code with TODAY’s version of Particle Dev? If you put this code through Particle Web IDE it will spit a bunch of obvious errors. The point is just that the Dev has some bad behavior in the face of coding errors.

```auto
int led0 = D0; // You'll need to wire an LED to this one to see it blink.
int led7 = D7; // This one is the built-in tiny one to the right of the USB jack
int ain0 = A0; // the light sensor
int ain1 = A1; // The temperature sensor
int A0val = 0;
int A1val = 0;
int tempF = 0;
int lightLevel = 0;
char state = "LOW";

// This routine runs only once upon reset
void setup() {
  // Initialize D0 + D7 pin as output
  // It's important you do this here, inside the setup() function rather than outside it or in the loop function
  Spark.variable("Light", &A0val, INT);
  Spark.variable("Temp", &A1val, INT);
  Spark.function("lightLed0", state);
  pinMode(led0, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(ain0, INPUT);
  pinMode(ain1, INPUT);

}

// This routine gets called repeatedly, like once every 5-15 milliseconds.
// Spark firmware interleaves background CPU activity associated with WiFi + Cloud activity with your code.
// Make sure none of your code delays or blocks for too long (like more than 5 seconds), or weird things can happen.
void loop() {
  A0val = analogRead(ain0);
  A1val = analogRead(ain1);
  lightLevel = lightLed0(state)
  digitalWrite(led7, LOW);
  delay(500); // Wait for 1000mS = 1 second
  digitalWrite(led7, HIGH);
  delay(500); // Wait for 1 second in off mode
}

int lightLed0(String, state)
{
  if state == "HIGH" {
  digitalWrite(led7, HIGH);
} else {
  digitalWrite(led7, LOW);
}

  return status_code;
}

```

---

<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:** [May 18, 2015, 8:58pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/8 "2015-05-18T20:58:02Z")

</div>

Sorry to report that my _Spark_ Dev 0.0.21 on Win 8.1 Pro does build and report errors as expected.

---

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 19, 2015, 1:16am UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/9 "2015-05-19T01:16:12Z")

</div>

OK\< Sorry, I should have given the OS and version. I am trying to compile in Particle Dev 0.0.23 and running in Mac OS X Yosemite Version 10.10.3.

So, if anyone can get the current version of the Particle Dev compiler to produce errors rather than “do nothing”, on Mac OS X with the code I posted above, it would be good to know. Either the Dev is not working, or I have some machine specific issue. I’ve done all the obvious things like completely removing older versions of Dev, not using stored files, but creating new files by cut and pasting text (code), and also, of course, verifying a web connection by having a browser open and interleaving compiles of the exact same code on the Particle Web IDE.

The suggestion that the new release would cure this prolem came from @suda, so perhaps he’ll have a go at compiling that code and report on the outcome 😄

---

<div class="post-metadata">

**Author:** ![suda](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/suda/32/18449_2.png) [@suda](https://community.particle.io/u/suda)\
**Post date:** [May 19, 2015, 6:16pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/10 "2015-05-19T18:16:27Z")

</div>

Hi @Bendrix, when I tried to compile code you pasted in Particle Dev 0.0.23 on same OS as you do I got 12 errors: [https://www.dropbox.com/s/27ld45jyay89x0x/Screenshot%202015-05-19%2011.11.21.png?dl=0](https://www.dropbox.com/s/27ld45jyay89x0x/Screenshot%202015-05-19%2011.11.21.png?dl=0)

You could try logging out and in again. If it doesn’t help could you share a screenshot of your Particle Dev?

---

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 19, 2015, 7:43pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/11 "2015-05-19T19:43:07Z")

</div>

Hey @suda,

Now it gets even more weird. I logged out and logged back in. Loaded the code from above into spark dev. Hit compile and got the compiling in the cloud message, then… Success!

What?

I opened Spark Build and copied the code right out of Dev and pasted it. Hit compile and got… Lots of errors.

So now I have a Spark Dev that takes code that won’t compile on Build, and tells me it compiled successfully and created a firmware file. Screenshot attached. ![](https://sea2.discourse-cdn.com/flex026/uploads/particle/5413/a0426211688976b3.png)

---

<div class="post-metadata">

**Author:** ![suda](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/suda/32/18449_2.png) [@suda](https://community.particle.io/u/suda)\
**Post date:** [May 19, 2015, 8:10pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/12 "2015-05-19T20:10:43Z")

</div>

Your `SparkDevTest2` file has no extension. Spark Dev will only include `.c`, `.cpp`, `.h` and `.ino` files. Binary which was the result is probably doing nothing or contains default Tinker app.

There should be an error that no files were included though. Created a ticket: [https://github.com/spark/spark-dev/issues/85](https://github.com/spark/spark-dev/issues/85)

---

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 19, 2015, 8:39pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/13 "2015-05-19T20:39:31Z")

</div>

Added the .c extension and got errors. Arrghh! Was that it all along?

Here is the doc for naming in Particle Build

**Create: You can create a new application by clicking the "Create New App" button. Give it a sweet name and press enter! Your app is now saved to your account and ready for editing.**

And here is the doc for naming in Particle Dev

"Before compiling your project, make sure your project files are in a dedicated directory. Notes: If other files not related to your project are present in the project directory, you may experience errors when trying to compile."

"All the files have to be on the same level (no subdirectories) like this"

"Compile buttonTo compile your current project, click on the Compile in the cloud button. If your code doesn't contain errors, you'll see a new file named PLATFORM\_firmware\_X.bin in your project's directory (where PLATFORM is name of currently selected platform and X is a timestamp)."

Particle Dev docs do not mention that you have to provide an extension to save the file. In Build, you don't. It appears to slap on the .ino extension for you. When users go from one IDE to another and basic behavior changes, its going to generate confusion.

If Dev will save the file with no extension, and the docs are not going to make it clear that you must include one in the name (uncommon requirement), the the error you generate should not say "

> [@suda](#):
>
> There should be an error that no files were included though.

It should say, "Please add a file extension to this filename. It will not compile without one." And it should say that even if the docs are complete, cause that's what the problem is.

😉

If you were going to try to make the Spark IDE as easy to use as the Adruino IDE, where many of your future customers may be coming from, and using simultaneously, please consider having the save button:

- Fix the name so there are no spaces, or anything else that corrupts  
the compiler

- Add the extension

- Create the Folder of the same name

Currently, the File, Save As dialog does not allow you to create a folder on the fly, so assuming you know what you must do, you have to open finder and create the folder before you can save, or use the create folder dialog.

---

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 19, 2015, 9:16pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/14 "2015-05-19T21:16:22Z")

</div>

And now I am having a new problem. A program that will compile in Build without errors, and flash to the core, and run as expected, will not compile in Dev. I get 13 errors. Here is the code:

```
int led0 = D0; // You'll need to wire an LED to this one to see it blink.
int led7 = D7; // This one is the built-in tiny one to the right of the USB jack
int ain0 = A0; // the light sensor
int ain1 = A1; // The temperature sensor
int A0val = 0;
int A1val = 0;
int tempF = 0;
int statusCode = 0;
String arguments;

// This routine runs only once upon reset
void setup() {
   Spark.variable("Light", &A0val, INT);
   Spark.variable("Temp", &A1val, INT);
   Spark.function("lightLed0", lightLed0);
   pinMode(led0, OUTPUT);
   pinMode(led7, OUTPUT);
   pinMode(ain0, INPUT);
   pinMode(ain1, INPUT);

}

// This routine gets called repeatedly, like once every 5-15 milliseconds.
// Spark firmware interleaves background CPU activity associated with WiFi + Cloud activity with your code.
// Make sure none of your code delays or blocks for too long (like more than 5 seconds), or weird things can happen.

void loop() {
   A0val = analogRead(ain0);
   A1val = analogRead(ain1);

   digitalWrite(led7, LOW);
   delay(500); // Wait for 1000mS = 1 second
   digitalWrite(led7, HIGH);
   delay(500); // Wait for 1 second in off mode
}

 int lightLed0(String args) {
     if (args == "0") digitalWrite(led0, LOW);
     if (args == "1") digitalWrite(led0, HIGH);
     int statusCode = 1;
     return statusCode;
 }

```

I cannot screenshot the the compile errors as drop down disappears when i try to use the GrabIt program. I also can’t find a show error log option, and if you click under Help, Documentation, you get:  
404 Not Found

Code: NoSuchKey  
Message: The specified key does not exist.  
Key: dev/index.html  
RequestId: 0E2549B66426372F  
HostId: p41CO7fYxFwNrlJVTKOlpxUZGj7Xs5/jwASrFMzPVr/fDhR3eWP97LhDI3Xl5JvV

I took a photo of the first few errors

![](https://sea2.discourse-cdn.com/flex026/uploads/particle/5418/df7660f54e6d299f.png)

AND THEN…

**On a lark, I changed the extension to .ino, rather than .c Now the program compiles. Does that make sense to @suda? Should that be how Particle Dev works?**

If so, I have a few questions.

- Are there certain libraries, headers, imports or whatever that are specific to the extension? So depending on the extension you use, your program may or may not compile?

- Does Particle and the Cloud IDE and the various pin names like D0 require or suggest a particular extension be used in order to compile the program?

- Same as above, is there a preferred, recommended or required extension to use when creating firmware for the Core or Photon?

There is soooooo much undocumented stuff going on with Dev…

---

<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:** [May 19, 2015, 11:21pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/15 "2015-05-19T23:21:24Z")

</div>

If you’ve called your file `*.C` or `*.CPP`, you’d need to add a line of `#include "application.h"`.  
If you’ve called it `*.INO` the proprocessor does this for you - this is also the case in the INO file the Web IDE opens for you by default.

---

<div class="post-metadata">

**Author:** ![suda](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/suda/32/18449_2.png) [@suda](https://community.particle.io/u/suda)\
**Post date:** [May 19, 2015, 11:21pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/16 "2015-05-19T23:21:31Z")

</div>

`.ino` files are in Wiring, Arduino’s C++ dialect and go thru a pre compiler which makes it Arduino compatible. To access constants/types like `A0` or `String`, you have to `#include "application.h"` and have your functions to be declared before being used. It [was announced some time ago](https://community.particle.io/t/build-ide-cpp-files-no-longer-pre-processed/3066) but you’re right, it should be in our documentation.

Edit: Wow, microseconds after @ScruffR 😄

---

<div class="post-metadata">

**Author:** ![Bendrix](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bendrix/32/5001_2.png) [@Bendrix](https://community.particle.io/u/Bendrix)\
**Post date:** [May 20, 2015, 1:16am UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/17 "2015-05-20T01:16:41Z")

</div>

Hi guys,

Thanks to you both for clearing this up. Its the sort of thing that once you know it, you know it. I’ll stick with .ino since that does some of the overhead for you.

If you fix the doc, the next newbie to come along won’t bother you with questions 😊

---

<div class="post-metadata">

**Author:** ![FiDel](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/fidel/32/8811_2.png) [@FiDel](https://community.particle.io/u/FiDel)\
**Post date:** [January 18, 2016, 10:47pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/18 "2016-01-18T22:47:39Z")

</div>

Hi, till now I have been using the Web IDE and I was quite happy with it.  
But now I want to use an Arduino library (FPS\_GT511C3 modified by @peekay123) for the fingerprint scanner, which is not (yet) in the Web IDE.

My first objective is to try out the communication between the Fingerprint scanner and a Photon.  
After that works, I want to try the other sketches…

Therefore, I installed Particle Dev today, trying to follow the (not so clear) instructions as closely as possible:  
I have created a program directory called “FPS\_Blink” and put all my project files in it:  
FPS\_Blink.ino, FPS\_GT511C3.cpp and FPS\_GT511C3.h

Then I opened the “FPS\_Blink.ino” sketch and hit the “Compile in the cloud” item in the Particle menu.  
After 10s working, I get an error:

* * *

_Uncaught TypeError: Cannot read property ‘replace’ of undefined_  
_/Applications/Particle Dev.app/Contents/Resources/app.asar/node\_modules/spark-dev/lib/views/compile-errors-view.js:51_  
_Show Stack Trace_  
_The error was thrown from the spark-dev package. Atom is out of date: 1.0.19 installed; 1.4.0 latest. Upgrading to the latest version may fix this issue._

* * *

(Sorry, I can’t post any screenshots yet…)

So, based on the last line, which includes a hyperlink, I download the latest version of ATOM for Mac.  
After downloading it, I start that application and then it looks like this is another generic version of Particle Dev…  
No help!

I am looking into the darkness…  
Can anyone shine a light on this please?

(I’m not a programmer but a hardware engineer with some programming background…)

---

<div class="post-metadata">

**Author:** ![FiDel](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/fidel/32/8811_2.png) [@FiDel](https://community.particle.io/u/FiDel)\
**Post date:** [January 19, 2016, 11:49am UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/19 "2016-01-19T11:49:42Z")

</div>

OK, I found how to upload images… 😉  
Here is a Particle Dev screenshot showing the message when I try to compile:  
 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/9/951ef8f5781954bf63c1fcf158a6515514935991.png)

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [January 19, 2016, 12:37pm UTC](https://community.particle.io/t/spark-dev-will-not-compile/11759/20 "2016-01-19T12:37:21Z")

</div>

Try to open the folder again, but this time, open the FPS\_blink folder directly from the menu. Don’t use the tree navigation, but open the actual folder.

[Next page](https://community.particle.io/t/spark-dev-will-not-compile/11759.md?page=2)
