Resolved - Advice sought on multiple libraries causing update issues

Hi All

I frequently get issues where I am informed by the IDE that updates cannot be installed for certain libraries, for example the Adafruit_GFX_library. It notes that two installations exist, which I assume is due to me using or copying it into a particular sketch. The two options are

  • F:\Users\LES\Documents\Arduino\libraries\Adafruit_GFX_Library
  • F:\Users\LES\Documents\Arduino\libraries\arduino_196778

I cannot associate any particular sketch with the second instance, however I am nervous about deleting it in case I end up affecting a sketch that currently works.

In some instances I have also made modified libraries where I have changed some of the library contents in order to suit a particular sketch, and have renamed the library accordingly, but these are also picked up by the update facility, I assume because a lot of the contents of the library are still shared. I do not want to delete the modified versions because they are done specifically to make the sketch work how I need it to, so would also like to know the best way to deal with this

Thanks

Les

Move the second library folder you listed to another location outside of the libraries folder. The IDE sometimes puts libraries in folders that do not match their name for reasons that I forget

Put the modified library files in the same folder as the sketch that uses them and change #include <something.h> to #include "something.h" so that the local folder version of the library is used

Thanks for the response, much appreciated

I'm still on my first coffee of the morning, as a result I need to get my brain up to speed - looking at your second statement, using < > means look in the libraries folder, and " " means look in local folder?

Cheers
Les

< > means look in the normal library paths only

" " means look in the local folder first and, if not found, look in the normal library paths

Note that the normal library path means more than just the libraries folder. It also means the built in libraries and any board specific libraries which are in different locations

Thanks again, that really does help my understanding

So to double check, if I am looking at making a bespoke library for a particular sketch, make a copy in the sketch folder, use " ", and then modify that one, leaving the original untouched

Cheers

Les

Yes, that's correct

Thanks for confirming

Les

Hi again

I have just tried to use the " " function to modify a font using this editor GitHub - tchapi/Adafruit-GFX-Font-Customiser: A little utility to customise pixel fonts for the Adafruit GFX library

I copied the output (essentially the same font but with the " . " and "4" glyphs modified) into Notepad++, then saved it as a .h file in the sketch folder as ILSFont.h. That gave an error as ILSFont.h not found in Adafruit_GFX.h folder, so I copied the Adafruit_GFX.h into the sketch
folder and updated the sketch to include "Adafruit_GFX.h" and copied the ILSFont.h file into that particular copy of the library fonts directory.

Using the sketch below, which functioned with other fonts, I substituted the display.setFont callout to display.setFont(&ILSFont); but keep getting not declared errors. The placement and the structure appear the same, but the sketch seems to ignore the copy of the Adafruit_GFX.h library in the sketch folder

Code



#include <Wire.h>
#include <SPI.h>
#include "Adafruit_GFX.h"
#include <Adafruit_SSD1305.h>
//#include "Fonts/FreeMonoBold18pt7b.h"
#include "ILSFont.h"
//#include <Fonts/FreeSerif9pt7b.h>

// Used for software SPI
#define OLED_CLK 13
#define OLED_MOSI 11

// Used for software or hardware SPI
#define OLED_CS 10
#define OLED_DC 8

// Used for I2C or SPI
#define OLED_RESET 9

// software SPI
//Adafruit_SSD1305 display(128, 32, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
// hardware SPI - use 7Mhz (7000000UL) or lower because the screen is rated for 4MHz, or it will remain blank!
Adafruit_SSD1305 display(128, 32, &SPI, OLED_DC, OLED_RESET, OLED_CS, 6000000UL);

// I2C
//Adafruit_SSD1305 display(128, 64, &Wire, OLED_RESET);



void setup() {

  Serial.begin(9600);
  while (!Serial) delay(100);
  Serial.println("SSD1305 OLED test");

  if (!display.begin(0x3C)) {
    Serial.println("Unable to initialize OLED");
    while (1) yield();
  }

  //display.display(); // show splashscreen
  delay(1000);
  display.clearDisplay();  // clears the screen and buffer
  display.setFont(&ILSFont);
  //display.setTextSize(3);
  display.setTextColor(WHITE);
  display.setCursor(5, 30);
  display.println("01.234");
  
  display.display();
}


void loop() {
}

These are the error messages

F:\Users\LES\Documents\Arduino\SSD1306_simple_test_font\SSD1306_simple_test_font.ino: In function 'void setup()':
F:\Users\LES\Documents\Arduino\SSD1306_simple_test_font\SSD1306_simple_test_font.ino:46:20: error: 'ILSFont' was not declared in this scope
   display.setFont(&ILSFont);
                    ^~~~~~~
Multiple libraries were found for "Adafruit_GFX.h"
  Used: F:\Users\LES\Documents\Arduino\libraries\Adafruit_GFX_Library
  Not used: F:\Users\LES\Documents\Arduino\libraries\arduino_196778
exit status 1

Compilation error: 'ILSFont' was not declared in this scope

I've obviously missed something out, despite it being (apparently) the same in structure, what have I mixed up?

Cheers

Les

The reason your modified libraries are being "picked up" is most likely that you only renamed the library folder, but didn't actually rename the library. The Arduino IDE Library Manager, which provides the library update facility identifies libraries by the value of the name field in the library's library.properties metadata file. You must edit that file and change the value of that field in order to rename the library.

Thanks for the fast answer

I renamed the folder and the include callout, and seems to recognise the renamed folder, however the 'ILSFont' was not declared still remains.

I'm aware that this probably now changes the subject of this thread beyond the original intent so if it needs to be moved or restarted as a new topic please let me know

Les

I have managed to determine the cause, there is a mismatch in the header of the new .h file, as there seems to be issues exporting the revised file.

This thread is resolved

Les

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.