Adding community libraries iffy

Hi I’m still getting my feet wet - looks really superb so far.
I’ve created a serial_test (usb) app that has worked and downloaded to a photon.
I want to add the Community supplied SPARKJSON to it to parse a serial stream over the USB.
I’ve gone through the menu of adding it to my app “Cloud_access.ino”, it says its included, and added headers, but on compile it says

cloud_access.cpp:7:33: fatal error: ./DynamicJsonBuffer.h: No such file or directory
#line 1 

I’ve tried it twice with the community libs and it doesn’t include the files
If i start from a clean .ino - I can include it, and then add my code afterwards and it works.

so I guess an FYI - perhaps add somethig to the FAQ

That’s a common mistake when libs are developed offline or with CLI/Dev and then not checked again after putting it up on Web Particle Build, since Build uses a different file structure.

The includes for Build should always look like this

#include "<LibraryName>/<HeaderFileName.h>" // case sensitive!

So in your case, if you have an explicit include of DynamicJsonBuffer.h you’d write

#include "SparkJson/DynamicJsonBuffer.h"

But if you imported the library correctly, you should have

#include "SparkJson/SparkJson.h"

which in turn includes the other headers anyway.

But when you say you’ve tried with other libs and have the same problem, I’d say you’ve not completed the import (right through to the ADD TO THIS APP button) correctly, since adding to existing apps does work

Thanks - I did get it included.
Then subsequently included some other community libs
#include “DynamicCommandParser/DynamicCommandParser.h”
#include "ThingSpeak/ThingSpeak.h"
and they did work OK.
So can’t tell you what went wrong with the first time. :frowning:
thanks for the detail.

1 Like