Missing example header from new library

Hi All,

I’m trying to import a library from Github into the build.particle.io IDE. Everything seems to work fine except that the IDE doesn’t find the example header file (2_ExampleListener.h).

It find’s all the other files, including the two headers in the firmware directory and I’ve tried renaming the header and pretty much everything else you can think of (including recreating the file from scratch) with no luck. What am I doing wrong?


@Undergrid, I believe you need to replace #include <application.h> with #include "application.h". :grinning:

@peekay123 Thanks for the suggestion, but sadly that hasn’t helped. The header is still missing.

@Undergrid, I just got everything to compile on the IDE. There is some confusion on file names.

1_JsonStreamingParser.ino  ---> filename is the same on the IDE
2_ExampleListener.h           ---> filename is the same on the IDE
2_ExampleListener.h.old      ---> this file should NOT be included
3_ExampleListener.cpp        ---> Copy file content to 2_ExampleListener.cpp

So when you create a new set of tabs for 2_ExampleListener.h, a matching cpp tab will also be created. Copy the code from 3_ExampleListener.cpp to the cpp tab.

Change all the <application.h> to "application.h" and the compile should work. :wink:

1 Like

Getting it to build isn’t the issue, I had it building in a regular project in the IDE (it just got a bit broken while I was trying to work out why the header went missing).

The problem is that the example header doesn’t get picked up when I import it as a library. Did you try that, or did you copy and paste things into the IDE?

As it stands, I completely recreated the github repository from scratch with good code that builds fine in the IDE and the IDE still doesn’t find the example listener header when importing it as a library.

Samples would need to include the library headers like this

#include "libraryName/libraryName.h"

just as it would be if you are importing a library into you own (non-example) project.

But I’m not sure, how additional files used for an example would be treated when using a sample, since IMO only the immediate example project file will be copied into the “root” folder of your project but no other files. You could have multiple .INO files in the examples folder and hence would end up with multiple .INOs in your project confusing the build farm which one to build.

So I’d say, that’s not going to work, but @suda might have a word to add :wink:

So this could be a limitation of the IDE I’m seeing?

I’ve modified the example so everything is in the ino file (and fixed the includes!) and that seems to work, so I guess that will do.

Thanks to everyone for your help.


In case anyone is interested, I was doing some work with this library recently.

I discovered that it has a bug that prevents it from parsing again after you’ve parsed a document. I corrected it in my local copy of the library. I’ll try to clean things up and submit a pull request, when I get a chance.

In my case, I’m using it to parse JSON payloads from an MQTT service, which in turn interfaces with homebridge (Apple HomeKit emulation). I’ll receive new incoming payloads as events occur. In my case, I’m making a control for my garage door, so when I use my phone to open the garage door, homebridge on a Raspberry Pi receives the event, which ties to the MQTT plugin and plops the JSON payload into the appropriate queue. Then my controller sees the message in the subscribed channel, parses it, and triggers the relay. Later, it will happen again when I send the close garage command via my phone.

As is, the parser gets hung up at the end of a document. I’ve fixed it to reset the state so that it’s ready to start parsing again.

1 Like

Hi dougal

Could you make your changes available somewhere please? I’d like to incorporate the fixes into the library.


Sorry about the silence – it’s been a crazy week here. I’m hoping I can find time to put a pull request in pretty soon.