Error compiling for board Arduino Uno & Multiple libraries were found.

Can you please help me with my code? I attach a copy below.

Here’s my code:

/*****************************************
Author: Mahmood .M
Purpose: To use an ultrasonic sensor to measure water level and control the switch with IR signal.
Date: 2 - 01 - 2020.
******************************************/

#include <NewPing.h> //Use the NewPing library by Tim Eckel.

#include "IRremote.h" //Use the IRremote library by shirriff.

#define TRIGGER_PIN 12 

#define ECHO_PIN 11

#define MAX_DISTANCE 200

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

IRsend irsend;



void loop() {
        if(sonar.ping_in() >= 62) //if distance to water surface is 62 inches and above. 
        {
        irsend.sendNEC(0xFEA857, 32); // Send "0xFEA857" IR signal to turn on the switch.
        delay(500);
        }
        if(sonar.ping_in() <= 8) //if distance to water surface is 8 inches and below.
        {
        irsend.sendNEC(0xFEA857, 32); // Send "0xFEA857" IR signal to turn off the switch.
        delay(500);
         }
        }

Here’s my error message:

Arduino: 1.8.10 (Windows 10), Board: "Arduino Uno"

libraries\IRremote\IRremote.cpp.o (symbol from plugin): In function `MATCH(int, int)':

(.text+0x0): multiple definition of `__vector_7'

libraries\NewPing\NewPing.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\maamu\AppData\Local\Temp\cctikOgh.ltrans0.ltrans.o: In function `main':

C:\Users\maamu\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\cores\arduino/main.cpp:43: undefined reference to `setup'

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "NewPing.h"
 Used: C:\Users\maamu\Downloads\Documents\libraries\NewPing
Multiple libraries were found for "IRremote.h"
 Used: C:\Users\maamu\Downloads\Documents\libraries\IRremote
exit status 1
Error compiling for board Arduino Uno.

Any help is appreciated, Thanks.

You’ll need a different version of one of the two libraries you’re using - they’re both trying to use the same timer.
I’d be inclined to drop NewPing, and just use the example code for the ranger

The solution to the "multiple definition of `__vector_7'" error is provided here:
https://bitbucket.org/teckel12/arduino-new-ping/wiki/Multiple%20Definition%20of%20"__vector_7"%20Error


The "Multiple libraries found for" message has nothing to do with your problem. That's just some helpful information the Arduino IDE provides. Generally, you can safely ignore the "Multiple libraries 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.

Note that there is a bug in Arduino IDE 1.8.10 that causes it to display "Multiple libraries found for" messages even when there were no multiple libraries. You'll know the legitimate "Multiple libraries found for" messages because they'll show the path to a library that was not used. The false "Multiple libraries found for" messages only show the path to the library that was used.

pert:
Note that there is a bug in Arduino IDE 1.8.10

Thanks for that. It didn't occur to me that it was a bug. It has never actually been a problem, but I had wondered of I was getting those dumb messages because I never use the library manager.

The bug has increased the occurrence of people thinking the "Multiple libraries found for" message is the cause of their compilation error. Fortunately, the bug has already been fixed, so we won't have to deal with it in Arduino IDE 1.8.11 and on.

It's just one of the growing pains associated with the transition to the Arduino IDE using arduino-cli.

Thank you for the perfect answer.
But In the link you attached, It said "In the NewPing.h file, TIMER_ENABLED is defined as "true" by default. Setting TIMER_ENABLED to "false"".
my question now is: How do can i set TIMER_ENABLED as false.
Thanks Once more.

Open C:\Users\maamu\Downloads\Documents\libraries\NewPing\src\NewPing.h in a text editor.

Change the line:

#define TIMER_ENABLED true      // Set to "false" to disable the timer ISR (if getting "__vector_7" compile errors set this to false). Default=true

to:

#define TIMER_ENABLED false      // Set to "false" to disable the timer ISR (if getting "__vector_7" compile errors set this to false). Default=true

Save the file.

After that, you should be able to use the NewPing and IRremote libraries together without having the "multiple definition of `__vector_7'" error.

(deleted)