Closed sherrellbc closed 7 years ago
yes it's a known issue and is due to the way Arduino-Makefile is made. I've tried working on it but never got the results I needed.
BUT, you can overcome that by having one header with the name of the folder and then including other headers in this one.
Just like here: https://github.com/weareleka/moti/tree/dev/lib/FreeIMU
I just have to include FreeIMU.h in my main.cpp
This is exactly as I did. I was hoping there would be a simpler solution. It may be simpler to just pass the include (-I) option to gcc pointing to the root user-lib directory and require the user to qualify the origin of the header in the include statement. Namely,
Just as is necessary when linking against some Linux resources (.e.g sys/stat.h, etc).
yes that also works! 👍
The provided example code has a user library structure as
Including this header works as expected in the current structure. However, if the intended header file name does not match the parent directory name then the build will fail with a "No such file or directory" error.
To reproduce, change the filename of lib/FooLib/FooLib.h to lib/FooLib/FooLib2.h and try to include it from FooProject.cpp. This is problematic for libraries with more than one header file.