Skip to content
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

Renaming files results in bogus compile errors (cache not properly cleared) #2323

Closed
3 tasks done
php4fan opened this issue Dec 30, 2023 · 1 comment
Closed
3 tasks done
Assignees
Labels
conclusion: duplicate Has already been submitted conclusion: off topic Off topic for this repository topic: CLI Related to Arduino CLI type: imperfection Perceived defect in any part of project

Comments

@php4fan
Copy link

php4fan commented Dec 30, 2023

Describe the problem

I had an existing sketch that compiled.

I added two new files using New Tab in the IDE, a .h and the corresponding .cpp, and filled them with code.

The actual code contained in the files was the intended one with no errors, but I accidentally misnamed the files with the name of a class that already existed in a library.

I attempted to compile and obviously got some errors. One error came from the fact that in the main sketch I was includeing the .h file with the intended name, but such file didn't exist because the file was misnamed. So that quickly made me realize my mistake.

So I fixed my mistake by renaming the files.

After that, everything was correct. And yet, the sketch wouldn't compile, giving a bunch of "multiple definitions of..." errors which made no sense whatsoever.

After wasting a lot of time trying to figure out what was wrong (assuming that there still was some wrong name somewhere), and googling the error, it finally occurred to me that maybe there was nothing wrong (now) with the code and this could be the result of some cached previously-compiled code not being removed from the cache.

I restarted Arduino (that didn't help), and then I cleared the cache by manually deleting files in /tmp/arduino/sketches and restarted again.

After that, and with no further changes to my code, everything compiled.

So, the errors that I had been getting after renaming the files were completely bogus.

To reproduce

I don't have a minimal reproducing sketch, or a non-minimal one that I can share for that matter, but what I did is explained above,.

Expected behavior

One should NEVER, EVER get errors when compiling that are not the result of actual errors currently existing in the code. Cache should be 100% reliable and transparent, meaning the result of compiling a sketch should never differ whether or not I clear the cache. If something in the cache is out of date, it should be invalidated and not used.

Additionally, the IDE should provide a way to clear the cache. Because one can never be sure there isn't some edge case that is not handled correctly. Like this one.
i.e. #419 should be reopened (should never have been closed in the first place)

Arduino IDE version

2.2.1

Operating system

Linux

Operating system version

Manjaro Linux

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@php4fan php4fan added the type: imperfection Perceived defect in any part of project label Dec 30, 2023
@per1234 per1234 self-assigned this Dec 31, 2023
@per1234 per1234 added topic: code Related to content of the project itself topic: CLI Related to Arduino CLI labels Dec 31, 2023
@per1234
Copy link
Contributor

per1234 commented Dec 31, 2023

Hi @php4fan. Thanks for taking the time to submit an issue.

I see we have another report about this at arduino/arduino-cli#1240.

It is best to have only a single issue per subject so we can consolidate all relevant discussion to one place, so I'll go ahead and close this in favor of the other.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 31, 2023
@per1234 per1234 added conclusion: duplicate Has already been submitted conclusion: off topic Off topic for this repository and removed topic: code Related to content of the project itself labels Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted conclusion: off topic Off topic for this repository topic: CLI Related to Arduino CLI type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants