Skip to content

Deleted header files remain includable #2072

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

Closed
fredrikeldh opened this issue May 13, 2014 · 4 comments
Closed

Deleted header files remain includable #2072

fredrikeldh opened this issue May 13, 2014 · 4 comments
Assignees
Labels
Component: Compilation Related to compilation of Arduino sketches Type: Bug

Comments

@fredrikeldh
Copy link

Tested with 1.0.5 on Windows.

To reproduce:

  • Have a sketch.
  • Create a file, let's call it "foo.h", in the sketch's directory.
  • Add #include "foo.h" to the sketch.
  • Compile the sketch.
  • Delete the file "foo.h".
  • Compile the sketch again. If the bug is present, there is no error message despite the header file being deleted.

This happens because the Arduino IDE copies all source files to a temporary directory, reuses that directory and does not clear it of files that shouldn't be there.

On Windows 7, the temporary directory may be called something like "c:\Users\AppData\Local\Temp\build4632717550972951918.tmp".

@sngl
Copy link
Contributor

sngl commented May 14, 2014

Hello @fredrikeldh,
have you tried to close and reopen the Arduino IDE. Closing it should clean the temporary directory.

@fredrikeldh
Copy link
Author

Closing the IDE does not remove any temporary files, but reopening it does create a new temp-build dir.

Interestingly, if you delete the temporary header file, it gets recreated when you verify, with the same contents as before, even if you've deleted or modified the original.

If you don't touch any temporary files, and modify the source header file, that modification does not get copied to the temporary directory. This means that if you modify the header, you must reload the IDE for that modification to take effect.

I've been trying to share code between sketches in a less roundabout way than Libraries, but that can't happen before this bug is fixed.

@ffissore ffissore assigned ffissore and unassigned cmaglie Oct 2, 2015
@ffissore ffissore added the Component: Compilation Related to compilation of Arduino sketches label Oct 2, 2015
@per1234
Copy link
Collaborator

per1234 commented Jul 3, 2017

I find that if I use the Arduino IDE 1.8.3 to delete the tab via the tab menu it works correctly. This may not have been the case at the time of the issue report as indicated by #4233 and #1161). It is only if you delete the tab from outside the IDE that this issue occurs now and that's not really unexpected behavior since the tab is still shown in the Arduino IDE even though the file was deleted from the disk.

Where I find more problematic behavior is this issue as it occurs when an included file is deleted from a subfolder of the sketch folder (e.g. `#include "src/foo/foo.h"). In this case there is no mechanism to delete the file from within the IDE so there is no alternative to deleting files from outside the IDE. I suppose that is more appropriate to discuss in the arduino-builder repository now.
EDIT: There is already an issue in the arduino-builder repository for how to solve this issue: arduino/arduino-builder#86

@per1234 per1234 self-assigned this Jan 15, 2023
@per1234
Copy link
Collaborator

per1234 commented Jan 15, 2023

Closing as resolved. I can still reproduce the fault via the modified procedure described in my previous reply when using Arduino IDE 1.8.3, but I cannot reproduce it via that procedure when using Arduino IDE 1.8.19 or Arduino IDE 2.x.

I didn't bisect the resolution so I don't know exactly where the bug was fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Compilation Related to compilation of Arduino sketches Type: Bug
Projects
None yet
Development

No branches or pull requests

5 participants