Adding source and include folders

I have a basic application building and flashing from the Particle Workbench where everything is in the src/ folder. However I would like to add an inc/ folder and possible some sub folders for libraries and such things. Where can I specify where the IDE should look for these files?

1 Like

Libraries should be placed in a lib folder with another subfolder per library.
If you download a library via the library manager you’ll see how the structure is supposed to be.

Makes sense for libraries. What about for organizing regular source/header files

2 Likes

Does anyone know what the answer to this is? It would be nice to be able to split my code up if possible.

There should be no issue in creating new source and header files under /src.

My project is currently structured as following:

bilde

Notice: If you choose to rename your Blinky.ino to Blinky.cpp you will need to include following to your new .cpp file.

#include “application.h”

When I use a cloud compile, the toolchain doesn’t seem to upload these additional files, local builds do however work. Is there a some project config where I need to specify the dependencies to upload?

Have you set it up for your current device?

Press ctrl+shift+p to bring up the command palette.

Enter: “Particle: Configure Project for Device”

This will bring you through the configurations.

I have, is there supposed to be anything special in the project.properties file? At present it just has the name defined.

@aarcov libraries is kind of a rough spot atm - apologies for the bumps :pray:

have you seen the docs on this? do they help any?

https://docs.particle.io/tutorials/developer-tools/workbench/#particle-libraries

if not, can you run Particle: Audit Environment and share the non-sensitive bits here?

I have since resolved this, the solution is outlined below.

Problem: The project will only build locally when I include another local (but inside of project folder files).

The intended usage/setup:
The intended approach was to develop with them as ‘loose’ files inside src, and then move them into libs once I am satisfied with them.

File structure before resolution
src/
my-project.ino
my-dev.hpp
my-dev.cpp

Solution:
For some reason, the Particle Cloud compiler or cloud uploader does not include *.hpp files only .h. The solution was to rename my *.hpp files to *.h. So for the above example my final structure is:
src/
my-project.ino
my-dev.h
my-dev.cpp

I also replicated this issue by putting the development includes in libs/dev/files.*

Do we know if this is a Workbench thing, or is there a flag to use *.hpp?

That’s an old CLI thing - for cloud build Workbench uses CLI.

1 Like