Error message : Multiple libraries were found for "Servo.h"

Unfortunately, due to the output coming from parallel processes, it was a little bit mixed together by the IDE. That makes them more difficult to interpret. I'll separate them out to make it easier to understand.

The first one:

The "Multiple libraries were found for" message has nothing to do with the compilation failure. It is only some helpful information the Arduino IDE provides. Generally, you can safely ignore the "Multiple libraries were found for" messages. The only time you need to pay attention to it is when the Arduino IDE picked a different library than the one you had intended.

In this case, there are two libraries installed on your computer that contain a file matching the #include directive in your sketch for Servo.h:

This one:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.51.0_x86__mdqgnx93n4wtt\libraries\Servo

is the official Arduino Servo library that comes with your installation of the Arduino IDE. That library is good for when you are using one of the official Arduino boards like the Uno. However, the Servo library uses some low level hardware specific code that must be configured specifically for each board architecture. Since Arduino doesn't make any ESP8266 boards, the official Servo library doesn't have support for the ESP8266 architecture.

So the ESP8266 boards platform authors have made their own variant of the Servo library and bundled it with the ESP8266 boards platform installation you make via the Arduino IDE's Boards Manager. Here:

C:\Users\Amogh\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.2\libraries\Servo

Since the platform bundled library has the same standardized API as the official Servo library, you probably wouldn't even notice that you are using a different library. The same sketches work on any board.

So all this is to say that, since the ESP8266 Servo library was used, everything is fine and you can safely ignore that message.


Now for the real error message:

When you see a "No such file or directory" error it almost always means you need to install the library that contains the missing file.

Often the code you're compiling will come with documentation (either a comment or separate document) that tells you where to get the library dependencies.

Note that libraries may have dependencies on other libraries. That is the case here. The Firebase library has a dependency on the ArduinoJson library. Even if your sketch only uses the Firebase library directly, you must install both libraries.

In other cases the author of the code will not have been so kind and you'll need to go on a hunt for the missing library.

A good place to start is the Arduino IDE's Library Manager:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE's menus.
  2. In the "Filter your search..." box, type some keywords you have gleaned from the missing file name.
  3. Scroll through the results for the right library. Click on it.
  4. Click the Install button.
  5. Wait for the installation to finish.
  6. Click the Close button.
  7. Try compiling your code again.

You will find your ArduinoJson library there, but I want to help you to understand how to deal with the "No such file or directory" error in general, so I'll provide some advice about what to do when you can't find it in Library Manager:

If you have no luck in Library Manager then load up your favorite search engine and do a search for the missing filename. You will often get multiple results. If you have a lot of results you might add "arduino" as an additional search keyword. I will usually prefer results from github.com since that is where most Arduino libraries are hosted and downloading from there is fast and easy. In some cases there will be multiple libraries that contain the given filename and you'll need to do some evaluation to determine which seems the most appropriate, then try it out.

After downloading the library you found, you'll need to install it. This requires a different process than the Library Manager installation. You will find instructions here:

1 Like