Is there a way to delete the cache folder from the IDE, or to tell the IDE to not reuse the cached files? (I searched the forum and couldn't find one mentioned)
I've connected the dots to realize if I use the IDE to rename some of my .h or .cpp files then often subsequent compilations will fail as they try to use outdated .o files with the old file names. Restarting the IDE is not sufficient to resolve the problem, but removing the cache folder works every time. That's not quite as simple as it seems because the cache folder is in the hidden Libraries folder on macOS.
So is there a way to tell the IDE to not reuse the cached files or to clear/delete them?
This happens with at least the last several IDE versions including 2.3.6. I'm on macOS 15.3.2
You could erase all of them. To find the one specific to your sketch, turn on "Show verbose output during compile" and the full path is mentioned often.
Is there a recommended way to rename .h and .cpp files to avoid triggering this bug? I'm going to try quitting the IDE entirely and using the Finder to rename them and then start the IDE again. Fingers crossed...
The only way you could avoid it would be to also rename the sketch (or otherwise change its path) when you renamed the files, which would cause a new build folder to be used.
I'm have a similar problem. Sounds like the IDE should be modified to included a "Rebuild Solution" like Visual Studio has under the build tab that rebuilds the sketch from scratch.
How do you get this recommendation into the IDE change queue?
Hi @reddogluna. It would be silly to add a cache clearing feature to Arduino IDE as a user unfriendly workaround for a bug. The correct use of the limited development resources is to fix the bug.
I agree that a bug should be fixed but there maybe conditions that would not be considered a bug that could cause a problem.
It's interesting Microsoft felt that having a "clean build" vs. just build was worth adding another button.
Again, How do you get this recommendation into the IDE change queue request and let the "team" decide
Microsoft has a lot more resources than the Arduino company.
I am the most senior and active member of the team who maintains the Arduino IDE project. So the team has already decided and you would only waste your time by submitting a formal request.
FWIW I was bit by this issue/bug once again today. I spent more time than I’d like to admit searching for a solution before google directed me back here to my thread from 6 months ago.
I completely agree that fixing the underlying bug would be the best approach but in the meantime users may fall into a difficult to diagnose trap that leaves their project stranded and uncompilable just by renaming a file.
Maybe it would be worthwhile to provide a workaround until the underlying bug can be fixed.
Possibilities:
Ideally fix the IDE/compiler to better handle renaming files
Add Tools menuitem for full clean recompile (good for hygiene anyway)
Or add Tools menuitem to delete cache (like browsers offer)
Or add Tools menuitem to at least open (reveal) the cache folder
Having an option for a full clean recompile is a good hygiene feature anyway to have in the long run as a validation that your full project is compilable from scratch with the currently installed set of libraries.
#2 and #3 are relatively easily understood commands even for someone not familiar with the details of this issue and they may be useful to resolve other issues with library versioning etc.
I agree none of these warrant a new button in the IDE as they should be rarely used. But having the capability somewhere in the Tools menu seems like a good UI and useful addition to me.
I’d certainly like to have such a menuitem right about now…