I keep on receiving "exit status 1" but I dont know where I can fix my code.

So I am trying to create a arduino project that uses a buzzer, keypad and ultrasonic sensor to detect packages and also to incorporate a mini "alarm" along with it if the packages are taken without inputting a code. No matter how many times I try to compile it:

// CONSTANTS

//ULTRASONIC SENSOR
#include "SR04.h"
#define TRIG_PIN 12
#define ECHO_PIN 11
SR04 sr04 = SR04(ECHO_PIN,TRIG_PIN);
long a;
#pragma GCC disagnostic ignored ""-Wwrite-strings"
// Defining where the Ultrasonic sensor is connected

// ACTIVE BUZZER
int buzzer = 12;//the pin of the active buzzer
int duration, distance;

//Initializing the buzzer

// KEYPAD
#include <Keypad.h>

char* password = "185"; //This is the security code which can be changed
char* temppassword = "";
int position = 0;
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keypressed;
//define the cymbols on the buttons of the keypads
char keyMap[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad myKeypad = Keypad( makeKeymap(keyMap), rowPins, colPins, ROWS, COLS);

// The last step was to intialize the keypad

void setup() {
Serial.begin(9600);
delay(1000);
pinMode(TRIG_PIN,OUTPUT);//intitialize the trig pin as an output
pinMode(ECHO_PIN,INPUT);//intiialize the echo pin as an input
pinMode(buzzer,OUTPUT);//initialize the buzzer pin as an output

}

void loop() {
long duration, distance;
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
duration = pulseIn(ECHO_PIN, HIGH);
distance = (duration/2) / 29.1;

if (distance <= 30) {
Serial.println("Object Detected.");
digitalWrite(buzzer, LOW);
}
if (distance >30) {
Serial.println("Object has left proximity, Return Object or Enter Security Code");
keypressed = myKeypad.getKey();
if(keypressed == '0' || keypressed == '1' || keypressed == '2' || keypressed == '3' ||
keypressed == '4' || keypressed == '5' || keypressed == '6' || keypressed == '7' ||
keypressed == '8' || keypressed == '9')
if (keypressed != NO_KEY)
{
if (keypressed == '0' || keypressed == '1' || keypressed == '2' || keypressed == '3' ||
keypressed == '4' || keypressed == '5' || keypressed == '6' || keypressed == '7' ||
keypressed == '8' || keypressed == '9')
{
temppassword +- keypressed;
}
if(keypressed == '*')
{
if (temppassword == password )
Serial.println("You may take your package.");
digitalWrite (buzzer, LOW);
} else
Serial.println("Authorities have been contacted.");
tone(buzzer, 400); // play 400 Hz tone for 500 ms
delay(500);
tone(buzzer, 800); // play 800Hz tone for 500ms
delay(500);
tone(buzzer, 400); // play 400 Hz tone for 500 ms
delay(500);
tone(buzzer, 800); // play 800Hz tone for 500ms
delay(500);
tone(buzzer, 400); // play 400 Hz tone for 500 ms
delay(500);
tone(buzzer, 800); // play 800Hz tone for 500ms
delay(500);
noTone(buzzer);
}
if (keypressed == '#')
{

temppassword="";
digitalWrite(buzzer,LOW);
}
}
}

I keep on receiving these error messages:

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

Compiling libraries...
Compiling library "HC-SR04"
Using previously compiled file: C:\Users\Andre\AppData\Local\Temp\arduino_build_311037\libraries\HC-SR04\SR04.cpp.o
Compiling library "Keypad"
Using previously compiled file: C:\Users\Andre\AppData\Local\Temp\arduino_build_311037\libraries\Keypad\Keypad.cpp.o
Using previously compiled file: C:\Users\Andre\AppData\Local\Temp\arduino_build_311037\libraries\Keypad\utility\Key.cpp.o
Compiling core...
Using precompiled core
Linking everything together...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\Users\Andre\AppData\Local\Temp\arduino_build_311037/Package_Protector.ino.elf" "C:\Users\Andre\AppData\Local\Temp\arduino_build_311037\sketch\Package_Protector.ino.cpp.o" "C:\Users\Andre\AppData\Local\Temp\arduino_build_311037\libraries\HC-SR04\SR04.cpp.o" "C:\Users\Andre\AppData\Local\Temp\arduino_build_311037\libraries\Keypad\Keypad.cpp.o" "C:\Users\Andre\AppData\Local\Temp\arduino_build_311037\libraries\Keypad\utility\Key.cpp.o" "C:\Users\Andre\AppData\Local\Temp\arduino_build_311037/..\arduino_cache_943630\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a" "-LC:\Users\Andre\AppData\Local\Temp\arduino_build_311037" -lm
C:\Users\Andre\AppData\Local\Temp\cc2gVHZI.ltrans0.ltrans.o: In function `Keypad::pin_read(unsigned char)':

C:\Users\Andre\OneDrive\Documents\Arduino\libraries\Keypad/Keypad.h:89: undefined reference to `digitalRead'

C:\Users\Andre\AppData\Local\Temp\cc2gVHZI.ltrans0.ltrans.o: In function `Keypad::pin_write(unsigned char, bool)':

C:\Users\Andre\OneDrive\Documents\Arduino\libraries\Keypad/Keypad.h:88: undefined reference to `digitalWrite'

C:\Users\Andre\AppData\Local\Temp\cc2gVHZI.ltrans0.ltrans.o: In function `Keypad::pin_mode(unsigned char, unsigned char)':

C:\Users\Andre\OneDrive\Documents\Arduino\libraries\Keypad/Keypad.h:87: undefined reference to `pinMode'

C:\Users\Andre\AppData\Local\Temp\cc2gVHZI.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_sr04':

C:\Users\Andre\OneDrive\Documents\Arduino\libraries\HC-SR04/SR04.cpp:7: undefined reference to `pinMode'

C:\Users\Andre\OneDrive\Documents\Arduino\libraries\HC-SR04/SR04.cpp:8: undefined reference to `pinMode'

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'

collect2.exe: error: ld returned 1 exit status

Using library HC-SR04 in folder: C:\Users\Andre\OneDrive\Documents\Arduino\libraries\HC-SR04 (legacy)
Using library Keypad in folder: C:\Users\Andre\OneDrive\Documents\Arduino\libraries\Keypad (legacy)
exit status 1
Error compiling for board Arduino/Genuino Uno.

What can I do to fix it?

Post a link to where you got the HC-SR04 and Keypad libraries from. Please use the chain links icon on the toolbar to make it clickable.

I got all my library files from my teacher in the class's content page. It may be private I'm not sure but I also have the zip files as well which i can post in the next reply if necessary.

Yeah, it wants a password. Please attach the library files.

These are the library files

Keypad.zip (9.48 KB)

HC-SR04.zip (3.18 KB)

Hmmm... I don't see any problems in the libraries and can't reproduce the issue. Try closing all Arduino IDE windows, restart the IDE, then try compiling again. That will clear the cache and hopefully solve the problem.

If that doesn't work I have one other suspicion about the cause.

That actually surprisingly worked, thank you so much! I've been stuck on this issue for the past 3 days and no matter what I tried I still couldn't figure out the issue in the code.

Glad to hear it's working for you now. Enjoy!
Per