Mysterious IDE Behavior

I worked around the problem, but I'm still interested in knowing what went on.

So I:

  1. Retrieved a simple EEPROM sketch from the Examples menu choosing one from the Examples for Generic STM32 F103 Series.

  2. Stripped out all the code from the sketch leaving only the #include statement and empty setup() and loop() functions. I verified that this stripped down example would compile.

  3. Retrieved my sketch that would not compile and Ctrl-C copied all the code.

  4. Pasted the code into a text editor and commented out all references to EEPROM including the #include statement and all the calls to the EEPROM library.

  5. Copied all the code from the text editor and pasted into the stripped-down example.

  6. Removed the empty setup() and loop() functions, and the result compiled successfully.

At step 3, if I pasted the code directly from the Arduino IDE and into the stripped-down example sketch, the result would not compile. I had to do it by way of the text editor.

From all this, especially the unexpected result when I pasted code from one sketch to the other within the IDE. I conclude that the Arduino IDE is doing something behind the scenes that I would really like to understand so I can avoid this nonsense in the future.

Any thoughts to this development?