ATmega328P/Libraries/15. Versions, and "multiple libraries found"
Libraries · 15 of 33

Versions, and "multiple libraries found"

Install the same library twice, in two folders, and the IDE compiles one and ignores the other. It says which in a note that starts "Multiple libraries were found". The note is not an error, but the copy it ignored may be the one you meant, so read the Used line and delete the folder you do not want.

Your board

Two folders, one header

The IDE does not keep a list of what you installed. Each time it compiles, it reads the header names in the sketch's #include lines and searches the library folders for them. Usually exactly one folder holds Bounce2.h. If two do, say the Library Manager's Bounce2 and a Bounce2-master copied in by hand, both are libraries as far as the IDE is concerned, and it has to pick one.

It picks by rules, in order: a library that can compile for this board's architecture beats one that cannot; a folder whose name and library name both match the header exactly beats one that only starts with it; and between two equal matches, your sketchbook beats the board package, which beats the IDE's own folder. Then it says what it did.

The message

Multiple libraries were found for "Bounce2.h"
  Used: /Users/you/Documents/Arduino/libraries/Bounce2
  Not used: /Users/you/Documents/Arduino/libraries/Bounce2-master
Two copies of one library: which one compiles
two copies
What is installed
Copies found
2
Compiled
Bounce2
Version
2.71.0
The copy you just downloaded is the one being ignored. A folder named exactly Bounce2 beats Bounce2-master, so your edits or the newer 2.72 in the downloaded copy never reach the board. Delete one of the two folders.

It is a note, not an error. The sketch compiled, with the folder on the Used line. Each Not used line names a folder that holds the same header and was left out. When the compile succeeds the IDE prints this only with verbose output on (File > Preferences > Show verbose output during: compile); when the compile fails, it prints it anyway, because the copy it chose may be why.

The one that bites is the copy you meant to use being on the Not used line. In the case above, the GitHub download is version 2.72 and the Library Manager's is 2.71.0. Download the newer one for a fix, copy it in beside the old one, and the board still gets 2.71.0 because a folder named exactly Bounce2 beats Bounce2-master. Nothing tells you, unless you read the note.

Keep one copy

Pick the copy you want and remove the rest:

  • A copy from the Library Manager: open its card, and choose Remove from the card's … menu.
  • A copy from a ZIP or a hand copy: close the IDE and delete the folder named on the Not used line.
  • A copy in the IDE's own folder or the board package: leave it. Yours in the sketchbook already wins, and other sketches may rely on the original.

Verify again. One copy left means no note, and with verbose output on, a line that names the one folder:

Using library Bounce2 at version 2.71 in folder: /Users/you/Documents/Arduino/libraries/Bounce2

Choosing a version

The releases a library's author has published stay listed in the Library Manager. Its card has a version list beside the Install button, and once the library is installed, Other Versions in the card's … menu. Choosing an older version replaces the installed one; there is still only one folder.

Go back a version when an update breaks a sketch that compiled before, and the sketch is not yours to change: an example from a book, or a project someone else wrote against an older release. Note the version that works in a comment at the top of the sketch, next to the Tools lines. A library's version is a setting the .ino does not carry, like the board.

When it does not work

My change to a library's code makes no difference

The IDE is compiling another copy. Turn on verbose compile output in File > Preferences, verify, and read the Used line under Multiple libraries were found, or the Using library line if there is only one copy. Edit that folder, or delete the other one.

A sketch that compiled last month fails after an update

The library changed how it is called. Read its release notes on the project page for the version you now have, then either change the sketch or go back: Other Versions in the card's menu in the Library Manager installs the old release in place of the new one.

The message names Servo, SD or another library I never installed

The IDE installed its own copy when it first started, and installing the same library from the Library Manager put a second copy in your sketchbook. Yours is the Used one. The message is harmless and can be left alone.

I deleted the Not used folder and the message is still there

There may be a third copy, or the IDE is still showing the output of the last compile. Verify again and read the new lines; each Not used line names one folder that still exists.

Where this goes next

Make a pin an output, drive it HIGH and LOW, and see it on the board.

digitalWrite and the pin-13 lamp →

Edit this page — content/books/atmega328p/versions-and-conflicts.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →