Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

personal header files are not found if they are alphabetically first in the folder. #1436

Closed
andrewdavidjamesburke opened this issue Jan 28, 2022 · 4 comments

Comments

@andrewdavidjamesburke
Copy link

Given an arduino file named:

m.ino

Now, should you have your own includes in the same directory, for example:

s.h
t.h

There will be no issue importing them.

#include "s.h"
#include "t.h"

However, should they be named as such:

#include "a.h"
#include "t.h"

I am recieving an error in this situation:

'a.h' No such file or directory.

renaming it to a number that alphabetically larger than the source file m.ino and deleting the c_cpp_properties.json and the output folder, results in a build that once again, works.

I am not sure if the is an arduino thing, or vscode thing, but its definitely a bug, at least for me.
I do not wish to use external library folders.

@github-actions github-actions bot added the triage New issues that have not been reviewed. label Jan 28, 2022
@adiazulay
Copy link
Contributor

I seem to remember a similar issue to this, and I think this happens if your parent directory name doesn't match the name of the .ino file.

@benmcmorran
Copy link
Member

I can reproduce this behavior, but only when the .ino file is named differently than the parent directory (e.g. sketch.ino in a directory named myproject doesn't work, but myproject.ino does). The requirement that the sketch and directory have the same name comes from Arduino itself and is unlikely to change. @Triangle4 does renaming your sketch or parent directory solve the issue?

@benmcmorran benmcmorran added needs-more-info More details about this issue are needed for it to be actionable. and removed triage New issues that have not been reviewed. labels Feb 7, 2022
@andrewdavidjamesburke
Copy link
Author

Thank you, I had no idea that requirement existed! I had a feeling it had to be something simple.

@github-actions github-actions bot removed the needs-more-info More details about this issue are needed for it to be actionable. label Feb 7, 2022
@benmcmorran
Copy link
Member

Glad that works! I opened #1448 to track improving the warnings in the extension for this case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants