Compiler issues:doubling and erroring edited code., uses temp Not actual

Ok Guys I'm having some annoying problems with my IDE. I have re-writing an old atmega code for Tetris to work with an updated MCU and TFT drivers. I have most of it working but it was a pain to get the program to work at all.

I had to convert a couple of functions to the new library so the program would work but when ever I would compile after debugging my code it would use the temp file instead of the actual file being edited. I ended up having to go through my system and erase any temp files through disk clean up. I removed the file opened it altered it then saved it to a different name then changing the name back once placed back in the program file. Then turning off my computer before ever getting it to compile again.

Now I had to add the correct button functions to the user input code in the code and the compiler doubles the alterations then tells me it's reading multiple functions one from my library that I'm altering the other from the temp file.

What can I do to stop this behavior.

As the code I'm using is kinda large and space in each post limited please be specific about the code you need to see if you need to see it.

You told us a lot, but not much of it is of much use to us. OS? IDE version?

Windows 10 and the latest arduino build on a new laptop.

If I remove the altered file and replace it with another copy of the original and it compiles. But it kind of defeats the purpose of debugging when it uses temp files instead of the actual file your working with.

Try this: File > Preferences > Aggressively cache compiled core (uncheck) > OK The option name indicates it only controls caching of the core so this might not do anything but it does seem like the problem is related to caching.

Is the file you're editing a sketch or a library?