Error compiling for board Arduino Ethernet

Good morning forum,

I am having some problems getting this code to work correctly. I have copied and pasted the error report below the code. To start with I wasn't sure if the board was working correctly so I carried out some tests , the board is in working order and the USB cable is fine. I need some ideas on how to resolve this please.

class DaysOfWeek {
    enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat };
    Days Day;
    

        void setup() {

          //     Serial.begin(115200);
          Day = Days::Mon;
          String Weekday = (String)DaysOfWeek::Mon;
          String WeekEnd = (String)DaysOfWeek::Sat;

        }

        void loop()
        {
        }
    };
    /*:Arduino: 1.8.15 (Windows 10), Board: "Arduino Ethernet"

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

      C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `setup'

      C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop'

      collect2.exe: error: ld returned 1 exit status

      exit status 1

      Error compiling for board Arduino Ethernet.

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

 
 /*     setup();
    
  for (;;) {
    loop();
    if (serialEventRun) serialEventRun();
  }
        
  return 0;
}
*/

You should count whether the curly parenthesis are matching.
It seems that your Class has one parenthesis more than usuals

The formatting should give you a clue. Your setup() and loop() functions should start in column 1 (aka global level) and since yours do not, they must be part of a previous structure, aka your class definition.

I found a solution.

byte Name, Days, Job;

class  DaysOfWeek {
  public:
    enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat };
};
class  JobType {
  public:
    enum Job { Polish, Drill, Mill, Lathe, Assembly, Package,  };
};
class  Employee {
  public:
    enum Name { Fred, Bob, Mick, Li, Arron, Peter, Greg, Tony  };
};

void setup() {
  
  Job  = JobType::Polish;
  Days = DaysOfWeek::Sun;
  Name = Employee::Bob;
  Serial.begin(115200);
  Serial.print(Days);
  delay(100);
  Serial.print(Job);
    delay(1000);
  Serial.print(Name);
}

void loop()
{

}


You defined setup() and loop() functions inside your object but you also need the global setup() and local() functions for your sketch:

class DaysOfWeek
{
    enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat };
    Days Day;

public:
    void setup()
    {
      //     Serial.begin(115200);
      Day = Days::Mon;
      String Weekday = (String)DaysOfWeek::Mon;
      String WeekEnd = (String)DaysOfWeek::Sat;
    }

    void loop()
    {
    }
} myDaysOfWeek;

void setup()
{
  myDaysOfWeek.setup();
}

void loop()
{
  myDaysOfWeek.loop();
}

Note:

      String Weekday = (String)DaysOfWeek::Mon;
      String WeekEnd = (String)DaysOfWeek::Sat;

This will set Weekday to "1" and WeekEnd to "6". Casting an enumeration value to String dos not get you the name. Typically you would use an array:

   const char * DaysNames{ "Sun", "Mon", "tue", "Wed", "thu", "Fri", "Sat" };
      String Weekday = Daynames[DaysOfWeek::Mon];
      String WeekEnd = DayNames[DaysOfWeek::Sat];

Thank you Johnwasser.