Including a non-Particle library into a project in the Particle workbench

@ScruffR Sorry, by that I meant it’s in the lib folder that’s part of the same project folder.

Link to folder

Apart from a warning, complies on my system - had to remove two files named .DS_Store in the folder you linked. Seems like you have a Work bench configratiom or installation issue ?

1 Like

@shanevanj Thanks for trying it on your system. I tried switching to localDeviceOS compile instead of cloud and I am getting a lot of errors similar to this:

./../../build/target/user/platform-13-m/Test//libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)':
/Users//ParticleProjects/BME280andOLED/Test/lib/Adafruit_SSD1306/src/Adafruit_GFX.cpp:420: multiple definition of `Adafruit_GFX::setTextWrap(bool)'
../../../build/target/user/platform-13-m/Test//libuser.a(Adafruit_GFX.o):/Users//ParticleProjects/BME280andOLED/Test/lib/Adafruit_SSD1306/src/Adafruit_GFX.cpp:420: first defined here

It looks like there’s an issue with the GFX library having things defined multiple times? But how is that possible if I only have one instance of the library?

Or there beeing multiple versions of the same library in your project.

@shanevanj, not sure how you were able to build that project.
There clearly is an #include <Adafruit_BME280.h> in Test.ino but that library is not present in the project nor is there a dependency reference in project.properties.

However, when I run
image for Adafruit_BME280 the project builds in the cloud and locally.

Just to get rid of the ARDUINO not defined message adding #include <Arduino.h> won’t harm.

@ScruffR My current errors still look similar to the one I posted above. They also exist for the SSD_1306 library. Here’s a view of my current library directory:

I figured the ARDUINO not defined message would be fixed that way and did that. So the only issue left would be the multiple definitions.

Having a copy of your project that actually contains all the files that may contribute to the issue would be helpful.
A stripped down version like the one you posted above won’t help in that regard as it may exactly not contain the offending files.

2 Likes

My bad, here’s the full project file structure:

There’s a file not shown in the picture, but it is just the README.md

Very strange that it complied!

Added Adafruit_BME280 and compiled no errors (other than the warning for pgm_read_byte)

I had this same issue for a while with the multiple defines. Do make sure that you clean your workspace. I deleted the target folder and then also executed the Particle: Clean application and device OS tool. That seemed to help me out.