[SOLVED]Can't compile in Particle Dev - everything is undefined

So I installed the Particle Dev environment, but am unable to compile the blink LED tutorial. When I select Compile In Cloud, it errors out saying all the I/O variables (D0, D7, HIGH, LOW, OUTPUT) are undefined. What header files are these defined in?

You need to add #include "application.h" unless you name your main project file .INO, which would be preprocessed accordingly.

Unfortunately that doesn’t do anything. Is a Particle Dev compatible Blink LED project on github?

So I found a Blink example on Spark Fun’s website which would compile. I’m not entirely sure what these .ino files are. Is there a decent set of documentation, as https://docs.particle.io/guide/tools-and-features/dev/ is lacking, the link which supposedly describes the difference between ino and c/cpp files links to the Online Store & Shipping Questions article (WTF?).

Wow this IDE is finicky. So I tried modifying SF’s Blink by adding my own .c and .h files. When compiling the IDE says there were no errors, but the bottom of the screen says “build didn’t produce binary Error: Command fai…” And of course the local compilation button does nothing when pressed.

Anyone have any idea what i’m doing wrong?


#include "application.h"
void myFunc();


long myVar = 0;
void myFunc() {


#include "test.h"
void setup() {
void loop() {

So my saga with this broken toolsuite continues. I installed the particle-cli and tried compiling that way

$ particle compile photon "Source Code"

Compiling code for photon

    /Users/administrator/Desktop/Alpha Scale Controller/Source Code/test.h
    /Users/administrator/Desktop/Alpha Scale Controller/Source Code/Blink.ino
    /Users/administrator/Desktop/Alpha Scale Controller/Source Code/test.c
attempting to compile firmware 
pushing file: /Users/administrator/Desktop/Alpha Scale Controller/Source Code/test.h
pushing file: /Users/administrator/Desktop/Alpha Scale Controller/Source Code/Blink.ino
pushing file: /Users/administrator/Desktop/Alpha Scale Controller/Source Code/test.c
../../../build/target/user/platform-6/libuser.a(Blink.o): In function `loop':
Blink.cpp:9: undefined reference to `myFunc()'
collect2: error: ld returned 1 exit status
make: *** [e1d6e7df507d2da0e3d3f9fe821e34cad7be2b162723287d494c2e1fa6fe.elf] Error 1

Compile failed. Exiting.

How is myFunc() undefined, if I defined it in test.h? Not surprisingly this code works perfectly fine in the Web IDE.

One thing, have you got the most recent CLI (npm update -g particle-cli).

The old version did only like .CPP files and not .C - you can also try to rename your file to .CPP.

I also try to avoid any file paths containing blanks, since some command line tools tend to not wrap the paths in double quotes breaking the path up into multiple parameters.

1 Like

The old version did only like .CPP files and not .C - you can also try to rename your file to .CPP.

Well this fixed it, thanks a lot! What a broken tool chain. I did install the particle-cli a couple minutes before I had made that post, so I can only assume it was the latest.

Hi , I am facing the same problem. I have updated the cli and tried to compile an empty project, but could not.have a look please, and see what else should i try.

This screenshot does not look like CLI it rather looks like Particle Dev :wink:
If you post a screenshot, could you provide one of the complete application window?

And maybe try selecting a device before you build, so that the IDE knows the target system.

Yes Exactly :smiley: from cli, it is compiling, but not with IDE.
here is the complete window:

What does your file directory look like? Is it ‘flat’? Does it contain other files than are necessary for your project?

The directory was D:\Example-PhotonDesktopIDE\TryChaChaPoly.ino and it had other .cpp and .h filea as well.
I tried with another example, in which,the directory is D:\Example-PhotonDesktopIDE\RegisteredCloudFunction\Example.ino
and it is the only file in the directory…but the issue persists…

A few points to check.

The screenshot you provided shows the cyan “dirty” spot to the right of the file tap, so there are changes that haven’t been saved (commited), but Particle Dev only builds what was saved.
I also see two open .INO tabs, in this case it’s not clear to Dev which one you want to build. Dev does not care what tab you’ve got open when you start build, since Dev is merely an Editor and not really an IDE. Building is rather triggered like an external command.
For above reason - it might be couterintuitive tho’ - it’s recommended to open the project folder rather than only a file from the folder, since the external command is aimed to build a complete folder content and not seperate files.

Finally, it helped. I removed all irrelevant Project folders and then compiled the .ino file, and is working.
Thanks for support :smile:


I have the same problem.
Updated CLI but no joy.

I have a structure like this, no other files or folders.


A function defined in ledControl.c, exposed in .h causes an undefined reference error.

Fixed by using:

#ifdef __cplusplus
extern "C" {

#include "ledcontrol.h"

#ifdef __cplusplus