Collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board Arduino Nano Every

I don't know what I'm doing wrong. I'm trying to upload the code I got for a project but I keep getting the following error:

Arduino: 1.8.16 (Windows 10), Board: "Arduino Nano Every, None (ATMEGA4809)"


C:\Users\leole\AppData\Local\Temp\ccPedqsB.ltrans0.ltrans.o: In function `setup':

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:16: undefined reference to `ServoEasing::attach(int)'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:17: undefined reference to `ServoEasing::attach(int)'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:18: undefined reference to `setSpeedForAllServos(unsigned int)'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:19: undefined reference to `ServoEasing::setEasingType(unsigned char)'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:20: undefined reference to `ServoEasing::setEasingType(unsigned char)'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:21: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

C:\Users\leole\AppData\Local\Temp\ccPedqsB.ltrans0.ltrans.o: In function `loop':

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:28: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:29: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:30: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:34: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:35: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:36: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

C:\Users\leole\AppData\Local\Temp\ccPedqsB.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_servoTop':

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:5: undefined reference to `ServoEasing::ServoEasing()'

C:\Users\leole\OneDrive\Desktop\IronMan_New_Helmet_Code_-_2_motor/IronMan_New_Helmet_Code_-_2_motor.ino:6: undefined reference to `ServoEasing::ServoEasing()'

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Arduino Nano Every.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Here is the code I'm using:

#include <Servo.h>

#include <ServoEasing.h>

ServoEasing servoTop;
ServoEasing servoBottom;
const int action_pin = 2;
int location = 31;
// Below numbers should be adjusted in case the facemask does not close/open to desired angle
int bottom_closed = 107;
int top_closed = 167;
int bottom_open = 20;
int top_open = 20;
void setup(){
pinMode(action_pin, INPUT_PULLUP);
servoTop.attach(9);
servoBottom.attach(10);
setSpeedForAllServos(190);
servoTop.setEasingType(EASE_CUBIC_IN_OUT);
servoBottom.setEasingType(EASE_CUBIC_IN_OUT);
synchronizeAllServosStartAndWaitForAllServosToStop();
}
void loop(){
int proximity = digitalRead(action_pin);
if (proximity == LOW)
{
if (location > bottom_open) {
servoTop.setEaseTo(top_open);
servoBottom.setEaseTo(bottom_open);
synchronizeAllServosStartAndWaitForAllServosToStop();
location = bottom_open;
delay(600);
} else {
servoTop.setEaseTo(top_closed);
servoBottom.setEaseTo(bottom_closed);
synchronizeAllServosStartAndWaitForAllServosToStop();
location = bottom_closed;
delay(600);
}
}
}

I installed the library correctly but I can't figure out what am I missing here. Please help.

Did you look, carefully, at the examples that come with the libraries paying special attention to the exact filenames of the included files?

The library I was instructed to add was servoeasing. When I searched servoeasing in the library, there was only one option, and that was the one I installed.

The file extension is important. That is what I was trying to point out.

Your include code's file.

#include "ServoEasing.hpp"

The include file from the OneServo example from the ServoEasing library.

If I change ServoEasing.h in your code to ServoEasing.hpp, your code compiles.

Thank you so much. It uploaded :slight_smile: