Hi
I have a quite large project with several files organized in several folders and subfolders.
I place them in the src folder of my main folder so that the main folder only has the following:
mycode.ino
src
partitions.csv (the code is for ESP32)
If I compile this complex code on Linux for example, I can tell the compiler and the linker to search for all the files using -I argument.
I expected that this would be taken care of automatically by using this src folder. However, it is not the case because I need to provide detailed paths for the #include of header files.
I hoped that I could add some similar option in the platform.txt file to help the compiler and linker find all the files they need without changing the paths in the #include instructions.
Is this possible, or do I really need to provide the detailed paths of all .h files ?
Thanks for your answer.
So basically, I need to provide in the #include statements the path to the header file relative to the file where the #include is.
For example, a file src/folder1/folder2/something.cpp that would need a header file in a folder such as src/include/myfunc/myfunc.h would require:
Not at this time. The Arduino developers are tracking the request to support bundling libraries with sketches here:
With the requested feature, Arduino development tools would do library discovery in the libraries subfolder of the sketch, just the same as it does in the existing libraries folders. This means that you could use #include directives for the sketch bundled libraries exactly the same as you do for non-bundled libraries.
if you organize the .cpp and .h files into subdirectories you generally have to use #include to the specific subdirectory, e.g. using the Microchip MPLABX IDE, in main.c