Thursday 1 December 2016

Compiling Using Particle CLI with Subfolders

I always like to keep things tidy and neat so I keep many things in subfolders such as ./sensors/xxxTemperature.cpp and #include them in the same way with relative directories. However, problems come after I updated my particle cli this morning (didn't happen before). The compiler started to tell me:
fatal error: No such file or directory ../build/target/user/platform-6xxxx

I tried with just one directory with everything in it and it worked, although I HATE it because it looks so fatty. "Stupid Particle" I said...

The first reference inspired me that Particle is actually making its compiler "smart" enough to search through all subfolders and we don't have to manually setup the relative directories. For example, if we have ./sensors/xxxTemperature.h, we usually write the include code:
#include "./sensors/xxxTemperature.h"

Now you can just (no...ONLY) follow the smart way by writing:
                                                   #include "xxxTemperature.h"

And the Particle Compiler could automatically search for it.

ref:
https://community.particle.io/t/subdirectories-not-compiling-in-cli-fixed/9283/5   (helped me.)
https://community.particle.io/t/compiling-using-cli-with-multiple-directories/24273
https://community.particle.io/t/multiple-folders-in-the-dev-ide-compile-errors-go-to-blank-file/18876




No comments:

Post a Comment