Strange Compile problem with Adafruit i2c sketch

Hi all,
Its been quite a few years since I did any programming and I'm just starting with the Arduino IDE.
I installed the Adafruit_SSD1306 and Adafruit_GFX libraries from Github and tried compiling the 128x64 example sketch. It throws an error here.

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

The define is correct in the header file

#define SSD1306_128_64
  // #define SSD1306_128_32
//   #define SSD1306_96_16
/*=========================================================================*/

#if defined SSD1306_128_64 && defined SSD1306_128_32
  #error "Only one SSD1306 display can be specified at once in SSD1306.h"
#endif
#if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16
  #error "At least one SSD1306 display must be specified in SSD1306.h"
#endif

#if defined SSD1306_128_64
  #define SSD1306_LCDWIDTH                  128
  #define SSD1306_LCDHEIGHT                 64
#endif
#if defined SSD1306_128_32
  #define SSD1306_LCDWIDTH                  128
  #define SSD1306_LCDHEIGHT                 32
#endif
#if defined SSD1306_96_16
  #define SSD1306_LCDWIDTH                  96
  #define SSD1306_LCDHEIGHT                 16
#endif

I have tried changing the defines, commenting out the three defines and multiple defines to see if I could get the compiler to throw any of the two errors

#if defined SSD1306_128_64 && defined SSD1306_128_32
  #error "Only one SSD1306 display can be specified at once in SSD1306.h"
#endif
#if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16
  #error "At least one SSD1306 display must be specified in SSD1306.h"
#endif

without success.

I opened another instance of the IDE and loaded the 32 line height example, expecting it to also error. To my surprise it compiled without error.

I'm at a loss to understand why the 32 line version compiled with the 64 line define active.

I've ran a compare on the two source files, there are only 2 code lines different. one is the compare that throws the number of lines error and the other one is an i2c address change.

I did the header file changes in Notepad++ and saved the file before recompiling. Does the IDE reread the library source when it recompiles, or does it assume it hasn't changed.

Is there anybody who can explain this, please

John

Did you restart the IDE right after you originally copied the library files ?

The IDE only looks at library files when it starts up. If you copy library files and then try to compile something right away, it won't work. You have to close the IDE and restart it, to make the library files get read.

That may be your problem. The issue with the 32 and 64 may be just a red herring.

No, I just installed the libraries then went to the example and loaded it. I'm used to compilers that check for changes.

I'll give it another run and see what happens, Thanks

No change.