it sounds like you may gave sone stray ‘extra’ fixes in the project folder on computer#
The compiler will try to choose the right files and folders, but if it’s a mess, might easily get it wrong, or use ‘extra’ files that aren’t needed.
The optimiser can also misinterpret your intentions if the sources are all tangled up when the compiler does it’s stuff.
I’m guessing disorganised workspace or misunderstanding how source files are used by Arduino IDE (it’s a bit weird)