how do i deal with multiple libraries installed?

I have received the following error message.

Multiple libraries were found for "WiFi.h" In file included from C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.cpp:15:0:

Used: C:\Users\hamil\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\WiFi C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory

Not used: C:\Arduino 1.8.9\libraries\W

How do I deal with this?

barryjo: Multiple libraries were found for "WiFi.h"

There is some bug in the Arduino IDE that caused a warning message and an error message to be mixed together with each other. The "Multiple libraries were found" warning message is nothing to worry about as long as the Arduino IDE is selecting the correct library. I can tell from the output that it is. This is how that warning message would look if the Arduino IDE was working correctly:

Multiple libraries were found for "WiFi.h"
Used: C:\Users\hamil\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\WiFi
Not used: C:\Arduino 1.8.9\libraries\W

barryjo: C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory

This is the error message you need to deal with. If the Arduino IDE were working correctly it would look like this:

In file included from C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.cpp:15:0:
C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory

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.

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:

  • Sketch > Include Library > Manage Libraries...
  • In the "Filter your search..." box, type some keywords you have gleaned from the missing file name.
  • Scroll through the results for the right library. Click on it.
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".
  • Try compiling your code again.

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 on 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:

Thank you very much. I am sure with this info I can fine the missing file.

I am puzzled now. I thought I installed the library for the DHT11 temperature sensor but where do I find it? I thought it would appear under Arduino 1.8.9>libraries but the library is not there so I cannot fine the DHT.h file.

I thought I installed the library for the DHT11 temperature sensor but where do I find it? I thought it would appear under Arduino 1.8.9>libraries but the library is not there

If you installed it correctly, it will be in the libraries folder which is in the file with all your sketches. The Windows path is Documents>Arduino>libraries

Hmmm... After starting Arduino, I went to tools>manage libraries and then entered DHT in the search window. There were two different libraries so I installed them both by clicking the Install button. However, when I go to Arduino>libraries they are not there.

What can be the issue? One was called "DHT sensor library by adifruit" and the other was called "DHT sensor library for ESPx"

Both libraries say "Installed"

You didn't read the error message carefully:

barryjo: C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory

This is telling you that your sketch uses a library which is installed at C:\ArduinoSketches\libraries\DHT_sensor_library. That library contains a file named DHT_U.h which has a dependency on another file named Adafruit_Sensor.h, but Adafruit_Sensor.h was not found. So obviously you do have the DHT library installed and it's silly to waste time trying to install it again. What you need to understand is that, just as some sketches have dependencies on libraries, some libraries also have dependencies on other libraries. That is the case here. The DHT sensor library has a dependency on the Adafruit Unified Sensor library. But, despite this being clearly stated in the DHT Sensor Library documentation, you didn't install the Adafruit Unified Sensor library. Install the library and the error will be fixed.

barryjo: There were two different libraries so I installed them both by clicking the Install button.

Bad idea. Flailing around doing many random actions in the hopes that one of them will happen to work may occasionally get you by, but more often it will only cause a lot of problems. Instead, take a very methodical approach. Read the information provided to you carefully. Make sure you understand and track the result of every action you take. This is the way to achieve success with Arduino and electronics.

I found the problem but not sure how to fix it.

Under file>preferences it seems that you have to enter the directory where your sketch is located.

Can I have sketches in different directories or must they all be under "Arduino sketches"? If I do have my sketch in another directory, then it seems that libraries are installed in the directory listed in the file preference.

I would like to organize my sketches in different directories and sub directories. Am I going to have to always change the file>preference sketch location as I move from one sketch to another if the sketches are in different directories?

Puzzling.

OK, so... If I get a new version of Arduino, and install it, do I have to reinstall or move the libraries to the newer version? I think I may have a lot of jumbled libraries in various positions.

Is there documentation that says where the sketches MUST go or can I put the sketches at a location of my choosing.

Lets say I have two users on my computer can I have a sketch directory called Johns_sketches and another called Jerrys_sketches? If so When I install a library do I have to do it for both users?

As you can tell, I am a bit confused as to where things should go.

barryjo: Under file>preferences it seems that you have to enter the directory where your sketch is located.

Wrong. File > Preferences > Sketchbook location defines the location of your sketchbook. The sketchbook is simply a convenient place to put sketches because any sketch installed under that location will be accessible under the File > Sketchbook menu. But you would not install the sketch files directly in the sketchbook folder. Each sketch is in a subdirectory of the sketchbook folder.

barryjo: Is there documentation that says where the sketches MUST go or can I put the sketches at a location of my choosing.

You can put sketches anywhere you like. If you want them to show up under the File > Sketchbook menu then you must put them under the sketchbook folder, but that is simply a convenience feature. You can always open sketches installed to any location on your computer via File > Open or by double clicking the sketch file (assuming you have .ino files associated with the Arduino IDE).

There are a locations where you should not install sketches: Arduino IDE installation folder: The reason is that, if you are using the installer, every time you update to a new version of the Arduino IDE you will lose everything in that folder. Libraries folders: The Arduino IDE will display a warning when it finds anything that is not a library saved to one of the libraries folders. The reason is that the Arduino IDE repeatedly scans these folder and so the more subfolders you have, the longer the scan takes, and thus the longer IDE startup, compilation, and uploads take.

barryjo: Lets say I have two users on my computer can I have a sketch directory called Johns_sketches and another called Jerrys_sketches? If so When I install a library do I have to do it for both users?

Each user has a separate preferences file, so they can each set their own sketchbook folder location. If they have separate sketchbook folders then they would each need to install the library individually.

Brattain,

I hope I explain this correctly.

Every time I get a new Arduino update, I unzip the new version in a new directory. I have directories named C:Arduino 1.6.11, C:Arduino 1.8.5, and C:Arduino 1.8.9. Each time I get a newer version, there is a new subdirectory in each of these directories.

So, Lets say I make a sketch using the Arduino 1.6.11 version and install some extra libraries in the library directory under 1.6.11, then if I decide to use the updated version say 1.8.5, I would have to (re)install the custom library in the library directory under the 1.8.5 directory. Put another way, there is a different library for each new version of Arduino.

I see that I have a directory called C:Sketches. In this directory is another library file. So I guess that the Arduino compiler looks first at the library associated with the version that you are using, and then looks in the library where the sketches are.

The problem I was having is because my file>preferences said my sketches were in C:Sketches when in fact the skecth I was working with was in a different directory called say C:XSketches and when I added a library the library file went into the C:sketches directory rather than into my C:XSketch directory where my ini file was located.

So, the solution is to make sure that file>preferences points to the directory where the ino file that you are using is located.

I think I understand now.

thanks again.

Brattain, Now another problem, see error below.

Multiple libraries were found for “WiFi.h”
Used: C:\Users\hamil\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\WiFi
In file included from C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.cpp:15:0:

Not used: C:\Arduino 1.8.9\libraries\WiFi
C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory

compilation terminated.

I thought you said (above) that having two libraries with the same name is OK but I get this error above. My question is, in my code is #include <WiFi.h> .There is a WiFi library under the Arduino 1.8.9 install directory. Since I am using a ESP32 module, I would probably expect another WiFi module that is made for this particular board/chip. So how does the compiler know which one to use.

I thought I was OK but now confused again.

I would probably expect another WiFi module that is made for this particular board/chip. So how does the compiler know which one to use.

Board selection in the ide window found at Tools>

I have received the follow errorss:

In file included from C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.cpp:15:0:

C:\ArduinoSketches\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory

What does "DHT_U.cpp:15:0:" mean?

and what does "DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory" mean?

1) Specifically are 14:0: and 36:29: line numbers in a file or what?

2) Is the file Adafruiit_Sensor.h referenced inside DHT_U?

Please ignore this request. I did not read the instructions.

IOs there a way to delete a post?

I've merged your cross posts @barryjo.

Cross posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes writing a detailed answer on this thread, without knowing that someone else already did the same in the other thread.

Repeated cross posting will result in a suspension from the forum.

In the future, please take some time to pick the forum section that best suits the topic of your question and then only post once to that forum section. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum section. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.