Thingspeak library not found

Once again, I’m getting a “No such file or directory” while trying to compile a program, this time using the Thingspeak library. This is in the Web IDE for a Photon. I included it the usual way, by clicking on the little flag tag, searching for Thingspeak, and selecting it from the list. I already tried changing the <>'s to quotes. Didn’t help.

And yes, I’ve already done a search on this problem with no results.

Double check what system version you are targeting. It should be 0.6.3 or greater (0.5.3 would be the first to support Libraries 2.0 - but using old target versions isn’t a good idea IMO).

I just got the same results, targeting 0.6.3 , manually typing :

#include <ThingSpeak.h>

void setup() {
}
void loop() {
}  

That wont Compile.

However, Web IDE will compile if you navigate to the Library, and add it to the Project:

image

It’s the same Code, but will compile

// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>

void setup() {
}
void loop() {
}  

I understood @Michele had done that when said

I had just assumed “selecting” meant hitting the INCLUDE IN PROJECT button too :see_no_evil:

But even when including it correctly, targeting 0.5.2 or before will also render a not-found error.

Oops, as usual my eyes move faster than my brain.

1 Like

Yes, I didn’t think to point out that in addition to selecting Thingspeak, I then followed up that action by clicking on “Include in Project”, and then selecting the name of my app. It still doesn’t include. This Photon is at 0.6.3.

And not to divert this thread, but it seems to me (warning: opinion follows) that the step of “Select which project” when including a library is redundant. If I’m editing foo.ino, then odds are good that that is the project I want the library in. Is there ever a case where this would not be true?

And for that matter, why can’t you include a library just by typing the include statment into your code?

This might be, but you can still target a previous version to build the firmware which would cause the issue.
That’s exactly why I said

The target version is independent of the system version on the device (for good reason).

This point was braught to Particle’s attention numerious times by me in private conversations and they have always agreed to address this but have more pressing things to address first. With the upcoming Mesh product line we hope to get a completely new set of dev tools too.

Because the respective files don’t exist in your virtual project directory. They need to be linked to your project first in order to become available to the build farm. You have to consider multiple versions of the same library with the same set of files and file names - your include statement does not provide any info about which version to use. And assuming you want the latest version might be true for most people, but not all.

OK, I checked that and it said “System firmware target o.6.1, on the device, 0.6.3”. So I changed the target to 0.6.3 and recompiled. Still won’t include. So I removed the incude statement and then reincluded Thingspeak. Still won’t compille. Then I tried changing the <>'s around the included filename to double quotes. Still won’t compile. Then I tried a different browser. Still won’t compile. Then I tried including Thingspeak into a blank project. Works fine.

Then I tried copying the entire body of my file that wouldn’t compile into the blank project that works (containing nothing but Thingspeak.h) and compiling that. That also worked. Go figure.

Could it be that this project had originally been created before the release of 0.5.3?
In that case the project file structure would still be pre v2.0 and hence incompatible with v2.0 libraries.

1 Like

No, the project was only created last week. The Photon I was flashing to already had 0.6.3 on it. It seems like once a library fails to include, that whole project becomes unrecoverably cursed.