I’m trying to understand how the new Extended Structure way of organizing projects and wrap my mind around the new Library Manager feature available in the latest Particle desktop IDE.
I seem to be able to compile OK when I “Add” a “Library” to my “Project”.
However, when I “Copy” a “Library” to my “Project”, the files get added to MyProject/lib, and when I go to compile the project I get hit with a “No such file or directory” error as shown in the following screenshot:
_
_
_
_ Question: How does one use a library that is “Copied” to a Particle Project instead of “Added”?
A little background:
I am used to using the “Legacy Structure” when working with my projects, and have never used the “.ino” workflow before (i.e. I always just have a main.cpp file that contains a #include “Particle.h” line at the beginning ). I don’t fully understand what a .ino file does. Does it just add that include statement by default, or are there other differences between using “.ino” and “.cpp”?
If I copy all the files in the root\lib\SdFat\src folder into the root\src folder, and delete root\lib I can get the Desktop IDE to compile (as shown below…)
So, it would appear that there is a problem with Desktop IDE wherein compilation only works when a Library is “Added” instead of “Copied”.
I have also replicated this issue with the OneWire library.
So, looks like the moral of the story is the Particle Dev doesn’t compile correctly unless you Add the library (not Copy it) or copy its source files into your “src” folder
I’d have to test your explicit case myself, but I know the feature works when the libraries are ported correctly and the project is set up right.
But unless you need to customise the library (e.g. make it build again after a poor port/migrate) you should rather use USE + Add to current project to only get the dependency added to project.properties instead of downloading the sources.
That also works for .cpp projects, not just .ino.
Also to note:
Complex libraries with deeper file structure (as SdFat is) are currently not too well supported when copied to your project.
Particle is working on that tho’
I agree, there is no real reason to use “Copy” instead of “Add” unless you want to modify the library.
Thanks for everyone’s input on this, the Particle suite of development tools keeps getting better and better and a few minor glitches on the way to greatness are affordable methinks
After playing a bit more with Copy to current project I found some extra hurdles to be aware of and which should get corrected by Particle.
Hence I filed a GitHub issue about that