-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Arduino sketches do not allow subdirectories for inclusion [imported] #1004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Fixed since 8e2c3c7 and available in latest hourly build http://www.arduino.cc/en/Main/Software#hourly |
This isn't working for me. (Or i'm doing it wrong...) Example code can be found at https://github.com/SuperTango/SubDirTest In this example, I have a simple sketch that uses a library called "KellyKLS_Serial". When the KellyKLS_Serial.cpp and KellyKLS_Serial.h files are in the sketch directory, everything works fine. (This can be seen by checking out the above repo and using the "lib_in_sketch_dir" tag). If I move the .cpp and .h files into a directory called "KellyKLS_Serial", the files are copied into the temporary directory properly, but the build fails with the errors:
(Note, full errors at https://gist.github.com/SuperTango/c9a706fcfe16d7221a07) this can be seen by checking out the "lib_in_subdir" tag from the repo referenced above. Note that due to caching, If I built successfully as in the first example, I needed to rebuild the whole thing (i did it by quitting arduino-1.6.6) in order to see the second build fail. |
@SuperTango you're right. files are copied but not compiled. I'm working on it |
arduino/Arduino#1004 (comment) Signed-off-by: Federico Fissore <[email protected]>
@SuperTango fixed in the hourly builds http://www.arduino.cc/en/Main/Software#hourly. Thank you for the heads up |
Thanks very much! |
Hello. Might this still be an issue in nov/2018 on IDE 1.8.7? I have a subfolder full of .cpp files and I get a whole lot of "undefined reference to" errors. Wasn't it fixed in 2015? |
You must have a folder called src in your sketch folder then:
|
Is there a good reason this is limited to being in ./src/? This seems unnecessary. |
This is Issue 1004 moved from a Google Code project.
Added by 2012-08-10T11:05:20.000Z by mackatack.
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium
Original description
I have a rather big (open source) project with quite a lot of files that I would like to move to subdirectories within the sketch directory.
for example:
sketch.ino
sketch.h
subdir/sub2/file.h
subdir/sub2/file.cpp
lib/libraryname/lib.h
utils/utilname/util.h
At this moment I cannot include files in subdirectories by using #include "subdir/sub2/file.h" because the files do not get copied to the temporary compilation directory. As a consequence I get the following order while compiling: "error: subdir/file.h: No such file or directory".
It's quite common that source code is split up in different logical folders as the developer sees fit. Please support subdirectories by copying all the files and directories to the compilation directory. The files in the subdirs should then also be able to include files in parent directories; #include "../parent.h" for example.
The text was updated successfully, but these errors were encountered: