note: I made a small edit here so future readers will see that the "install vs add" is not the essential part of the problem and only a very small part of the solution
I do:
particle create project
particle library install Grove_LCD_RGB_Backlight (or any library)
or
particle library add Grove_LCD_RGB_Backlight (or any library)
I would expect now that:
#include "Grove_LCD_RGB_Backlight.h"
Would compile. But I get this compiler output.
fatal error: Grove_LCD_RGB_Backlight.h: No such file or directory
I can see that the library is added to:
[My Documents]\Particle\Community\Libraries\Grove_LCD_RGB_Backlight@1.0.1
and project.properties has this line
dependencies.Grove_LCD_RGB_Backlight=1.0.1
So the install command seems to have worked but still the compiler cannot find the library files.
Youâd want to use particle library add or particle library copy
AFAICT there is no particle library install officially supported by CLI.
>particle help library
Manage firmware libraries
Usage: particle library <command>
Help: particle help library <command>
Commands:
add Add a library to the current project.
create Create a new library in the specified or current directory
copy Copy a library to the current project
list List libraries available
migrate Migrate a local library from v1 to v2 format
search Search available libraries
upload Uploads a private version of a library.
publish Publish a private library, making it public
view View details about a library
Thanks for the links, I had watched that tut. However, it uses the WebIDE which does add libraries correctly. I should have mention I am using particle workbench and Particle-CLI.
Great question, I have no idea. But I also tried library add. It seems to be a synonym. Both seem to do the same thing.
You did put me on to library copy though. That does the trick.. I did some very rudiemetary tests and here is what I see
"particle library install" downloads the library to [documents]\Particle\Community\libraries but does not add the dependency to project.properties
"particle library add" installs if not found and then ass the dependency to the project
"particle library copy" copies from [documents]\Particle\Community\libraries to my project lib folder but does not add the dependencies.
@m_m thanks for the pointer. You are right. I bailed on that video after seeing it work differently in WebIDE. In the video they use the Command Pallet âParticle: Install Libraryâ (which may be where I came up with âparticle library installâ?) It works as advertised . I should have been using it all along. I was trying from the Particle CLI and it seems just slightly gooey in the middle still (almost fully baked).
Command Pallet âParticle: Install Libraryâ. A-OK (Would love to know which CLI commands it uses
Still, it leaves me with one question: if I do particle library add, it downloads and installs to the community libraries folder and adds the dependency but it is not in the search path. I still need to copy it to my project. What is the point of putting it in the community folder if it is not in the include path?
@m_m, @ScruffR Thank you both for helping me get this sorted out.
if I do particle library add, it downloads and installs to the community libraries folder and adds the dependency but it is not in the search path. I still need to copy it to my project. What is the point of putting it in the community folder if it is not in the include path?
it's unfortunately a bit of a left-over from the days when cloud compilation was the only option and most users would only particle library copy if they wanted to read / edit the underlying code. or, well, i think that's more or less it... this stuff largely predates me
Yup, that's the expected behaviour and that normally is enough to work for a cloud compile.
If it is not working for you, then it is probably the way how you compile.
What command are you using and where do you execute the command from?
Normally you shuld use particle compile <platform> . from the directory where project.porperties lives. If you run that from within the src folder the dependencies won't be used for the build but merely all the files present at that location and underneath will be used.
BTW, for me, when I use Particle: Install Library it actually gets downloaded into the lib folder inside my project and not into Particle\Community\libraries. @m_m, is there a setting to control the default target for library downloads?
@ScruffR I think we are both seeing the same thing.
With Workbench->Command Pallet | Particle: Install Library the library is installed to my Project/lib folder and the dependency is added and everything compiles fine.
With Particle-CLI
particle library install
downloads to the community projects folder.
particle library add
adds the dependency
and
particle library copy
duplicates the library into the project/lib folder.
My mistake was expecting the CLI commands to mirror the Command Pallet commands. They donât. But they each work correctly in their own way.