Problem compiling on arduino mega

So I can’t compile a menu code I’m working with and I see this message:

“”""""
Arduino:1.8.5 (Windows 10), Tarjeta:“Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

C:\Users\pc\AppData\Local\Temp\ccTgsEeq.ltrans0.ltrans.o: In function `main’:

ccTgsEeq.ltrans0.o:(.text.startup+0x246): undefined reference to `loop’

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compilando para la tarjeta Arduino/Genuino Mega or Mega 2560.

Este reporte podría tener más información con
“Mostrar salida detallada durante la compilación”
opción habilitada en Archivo → Preferencias.
“”""""""""

Im pretty new to the menu topic so this code is basically a recopilation of some codes I’ve found online (maybe it’s just all wrong), could you help me?

The code is:

#include <MenuBackend.h>

#include <LiquidCrystal.h> 

 
const int buttonPinLeft = 8;      // pin for the Up button
const int buttonPinRight = 9;    // pin for the Down button //
const int buttonPinEsc = 10;     // pin for the Esc button
const int buttonPinEnter = 11;   // pin for the Enter button

int lastButtonPushed = 0;

int lastButtonEnterState = LOW;   // the previous reading from the Enter input pin
int lastButtonEscState = LOW;   // the previous reading from the Esc input pin
int lastButtonLeftState = LOW;   // the previous reading from the Left input pin
int lastButtonRightState = LOW;   // the previous reading from the Right input pin

long lastEnterDebounceTime = 0;  // the last time the output pin was toggled
long lastEscDebounceTime = 0;  // the last time the output pin was toggled
long lastLeftDebounceTime = 0;  // the last time the output pin was toggled
long lastRightDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 500;    // the debounce time

static void menuUsed(MenuUseEvent used);
static void menuChanged(MenuChangeEvent changed);

LiquidCrystal lcd(8,9,4,5,6,7);
//Menu variables

MenuBackend Menu = MenuBackend(menuUsed,menuChanged);
//initializa menu items
MenuItem MenuLavado = MenuItem("Lvd");
MenuItem MenuLavadoSubMenu1 = MenuItem("Nrml");
MenuItem MenuLavadoSubMenu2= MenuItem("Dlcd");
MenuItem MenuLavadoSubMenu3 = MenuItem("Msco");
MenuItem MenuLavadoSubMenu4 = MenuItem("Etr");
MenuItem MenuCentrifugado = MenuItem("Cntrfgd");
/////////////////////////////////////////////////////////////////
void setup()
{
pinMode(buttonPinLeft, INPUT);
pinMode(buttonPinRight, INPUT);
pinMode(buttonPinEnter, INPUT);
pinMode(buttonPinEsc, INPUT);

lcd.begin(16, 2);

//configure menu
Menu.getRoot().add(MenuLvd);
MenuLavado.addRight(MenuCntrfgd);
MenuLavado.add(MenuLavadoSubMenu1).addRight(MenuLavadoSubMenu2).addRight(MenuLavadoSubMenu3).addRight(MenuLavadoSubMenu4);
Menu.getRoot();
lcd.setCursor(0,0);
lcd.print("Bienvenido :D");
}

void menuChanged(MenuChangeEvent changed){

MenuItem newMenuItem=changed.to; //get the destination menu

lcd.setCursor(0,1); //set the start position for lcd printing to the second row

if(newMenuItem.getName()==Menu.getRoot()){
lcd.print("Main Menu       ");
}else if(newMenuItem.getName()=="Lvd"){
lcd.print("L          ");
}else if(newMenuItem.getName()=="Nrml"){
lcd.print("N");
}else if(newMenuItem.getName()=="Dlcd"){
lcd.print("D");
}else if(newMenuItem.getName()=="Msco"){
lcd.print("M");
}else if(newMenuItem.getName()=="Etr"){
lcd.print("E");
}else if(newMenuItem.getName()=="Cntrfgd"){
lcd.print("C");
}
}
void menuUsed(MenuUseEvent used){
lcd.setCursor(0,0);
lcd.print("You used        ");
lcd.setCursor(0,1);
lcd.print(used.item.getName());
delay(3000);  //delay to allow message reading
lcd.setCursor(0,0);
lcd.print("ITOSWare :D");
Menu.getRoot();  //back to Main
}
///
void  readButtons(){  //read buttons status
int reading;
int buttonEnterState=LOW;             // the current reading from the Enter input pin
int buttonEscState=LOW;             // the current reading from the input pin
int buttonLeftState=LOW;             // the current reading from the input pin
int buttonRightState=LOW;             // the current reading from the input pin

//Enter button
// read the state of the switch into a local variable:
reading = digitalRead(buttonPinEnter);

// check to see if you just pressed the enter button
// (i.e. the input went from LOW to HIGH),  and you’ve waited
// long enough since the last press to ignore any noise:

// If the switch changed, due to noise or pressing:
if (reading != lastButtonEnterState) {
// reset the debouncing timer
lastEnterDebounceTime = millis();
}

if ((millis() - lastEnterDebounceTime) > debounceDelay) {
// whatever the reading is at, it’s been there for longer
// than the debounce delay, so take it as the actual current state:
buttonEnterState=reading;
lastEnterDebounceTime=millis();
}

// save the reading.  Next time through the loop,
// it’ll be the lastButtonState:
lastButtonEnterState = reading;

//Esc button
// read the state of the switch into a local variable:
reading = digitalRead(buttonPinEsc);

// check to see if you just pressed the Down button
// (i.e. the input went from LOW to HIGH),  and you’ve waited
// long enough since the last press to ignore any noise:

// If the switch changed, due to noise or pressing:
if (reading != lastButtonEscState) {
// reset the debouncing timer
lastEscDebounceTime = millis();
}

if ((millis() - lastEscDebounceTime) > debounceDelay) {
// whatever the reading is at, it’s been there for longer
// than the debounce delay, so take it as the actual current state:
buttonEscState = reading;
lastEscDebounceTime=millis();
}

// save the reading.  Next time through the loop,
// it’ll be the lastButtonState:
lastButtonEscState = reading;

//Down button
// read the state of the switch into a local variable:
reading = digitalRead(buttonPinRight);

// check to see if you just pressed the Down button
// (i.e. the input went from LOW to HIGH),  and you’ve waited
// long enough since the last press to ignore any noise:

// If the switch changed, due to noise or pressing:
if (reading != lastButtonRightState) {
// reset the debouncing timer
lastRightDebounceTime = millis();
}

if ((millis() - lastRightDebounceTime) > debounceDelay) {
// whatever the reading is at, it’s been there for longer
// than the debounce delay, so take it as the actual current state:
buttonRightState = reading;
lastRightDebounceTime = millis();
}

// save the reading.  Next time through the loop,
// it’ll be the lastButtonState:
lastButtonRightState = reading;

//Up button
// read the state of the switch into a local variable:
reading = digitalRead(buttonPinLeft);

// check to see if you just pressed the Down button
// (i.e. the input went from LOW to HIGH),  and you’ve waited
// long enough since the last press to ignore any noise:

// If the switch changed, due to noise or pressing:
if (reading != lastButtonLeftState) {
// reset the debouncing timer
lastLeftDebounceTime = millis();
}

if ((millis() - lastLeftDebounceTime) > debounceDelay) {
// whatever the reading is at, it’s been there for longer    if (millis() – lastLeftDebounceTime) > debounceDelay) {
// than the debounce delay, so take it as the actual current state:
buttonLeftState = reading;
lastLeftDebounceTime=millis();
}

// save the reading.  Next time through the loop,
// it’ll be the lastButtonState:
lastButtonLeftState = reading;

//records which button has been pressed
if (buttonEnterState==HIGH){
lastButtonPushed=buttonPinEnter;

}else if(buttonEscState==HIGH){
lastButtonPushed=buttonPinEsc;

}else if(buttonRightState==HIGH){
lastButtonPushed=buttonPinRight;

}else if(buttonLeftState==HIGH){
lastButtonPushed=buttonPinLeft;

}else{
lastButtonPushed=0;
}
}

void navigateMenus() {
MenuItem currentMenu= Menu.getCurrent();

switch (lastButtonPushed){
case buttonPinEnter:
if(!(currentMenu.moveDown())){  //if the current menu has a child and has been pressed enter then menu navigate to item below
Menu.use();
}else{  //otherwise, if menu has no child and has been pressed enter the current menu is used
Menu.moveDown();
}
break;
case buttonPinEsc:
Menu.getRoot();  //back to main
break;
case buttonPinRight:
Menu.moveRight();
break;
case buttonPinLeft:
Menu.moveLeft();
break;
}

lastButtonPushed=0; //reset the lastButtonPushed variable
}

Every Arduino sketch must have a loop function even if you just leave it empty. Your code doesn't have a loop function and so that's why you're getting the error.

Oh wow, that was easy. Thanks for helping, I appreciate it