My Compiler Still Compiles a Library After I Delete the .cpp and .h Files

So I have library and I started editing it....compiled and failed seems like it wasnt picking up the changes (can't find member that I just added)...then I started to purposefully induce errors into the library (with perfect arduino code) and it would compile perfect (like it wasn't picking up the changes again). Then I deleted my .cpp and .h files in the library would compile....I was exiting and restarting arduino IDE between changes.

Very perplexed. Any advice appreciated.


I experienced the same issue. Typically, this happens to me after I add a library that turns out to not be useful - or compatible. Although I delete the .h and .cpp files just as you describe doing, the compiler seems to ignore the changes and continues to list the same errors that deleted library caused.

The only way I have resolved my issue with this is using this work-around: 1) I unplug my Arduino (I am using an Uno); 2) I save my sketch; 3) I exit the Arduino IDE completely; 4) I then restart the IDE and sketch; 5) and finally, I re-compile the sketch. Then - and only then - do the deleted library errors disappear.

At first I thought it was just a nuisance, but your experience is my experience. I look forward to reading what others suggest needs to change to prevent this “nuisance.”

I wonder if the operating system keeps the files alive in the background because the Arduino IDE appears to be using them. When you exit the IDE the O/S would know they are no longer needed.


The IDE keeps a copy in a temp folder: Third bullet point explains it.

You can turn on verbose mode in the IDE, when you compile it shows the compile path in the output window.

If you open up this folder and delete its contents, it will solve your problem.

I turned on verbose mode but didnt delete the files. I exited the IDE / Restarted but it was still having problems. I will try other methods and report back. Thanks for the suggestions.

cmcgonag: I turned on verbose mode but didnt delete the files.

Read pyro_65's post again. He didn't suggest it would delete the files - he said it would enable YOU to delete the files.

Ok I cleared out my files. I also found one of my libraries had an existing file named the same as a different library. When searching through the folders for the .h file to upload arduino IDE pulled the .h file from a different library folder and loaded it into the IDE overwriting the .h file that I had modified.