Fatal error missing header file

I’ve just tried to build my project. It was building fine without issue, then when I built it again I got the error:

PhotonCopter.cpp:2:21: fatal error: Logging.h: No such file or directory

I undid all changes but I still get the same error. I tried removing all references to Logging.h and then the build failed by claiming another header was missing. I am building this using the command line:

particle compile photon .

When I look at the build log it has listed Logging.h (and all the other headers and cpp files) as being included in the build.

I am struggling to see how there can be an error in the code, as I reverted the whole code to a previous version that I know could successfully build.

OK, this seems to be because the compiler is not allowing me to put my classes in sub-folders. If I strip this down to a bare minimum project with just the .ino file and the Logging.h and Logging.cpp files then it fails to build. If I move the Logging.h and Logging.cpp into the same folder as the .ino file then it builds without issue.

If I declare my includes like: #include “Services/Logging/Logging.h” then it starts building again.

Is this change something I am doing wrong or has the compiler on particle.io changed?

Hard to tell with not knowing your exact file structure, but since the release of Libraries 2.0 you should use the structure provided via CLI 1.19.2 (or later)

particle project create

Where additional library files (that are not imported from the official library repo via particle library add <libName>) should be put inside the dedicated lib/<myLib>/src sub directory.

OK thanks, following the structure outlined in the “particle project create” seems to be making some improvements. The .ino file no longer complains about missing headers. My libraries, however, that have dependencies on some of my other libraries now complain about the headers missing.

So my library structure is:

MyProjectFolder\lib\library1\src\library1.h and .cpp
MyProjectFolder\lib\library2\src\library2.h and .cpp

library1.h has an include:

#include "library2.h"

It is this include that is getting the compile error: "No such file or directory"

UPDATE: Seems fine now, I was missing the projects.properties file in the project root, all works now. Thanks.