Problem with Compilling code

/*
DS3231: Real-Time Clock. Simple example
Read more: www.jarzebski.pl/arduino/komponenty/zegar-czasu-rzeczywistego-rtc-ds3231.html
GIT: GitHub - jarzebski/Arduino-DS3231: DS3231 Real-Time-Clock
Web: http://www.jarzebski.pl
(c) 2014 by Korneliusz Jarzebski
*/

#include <Wire.h>
#include <DS3231.h>

DS3231 clock;
RTCDateTime dt;

void setup()
{
Serial.begin(9600);

// Initialize DS3231
Serial.println("Initialize DS3231");;
clock.begin();

// Set sketch compiling time
clock.setDateTime(DATE, TIME);
}

void loop()
{
dt = clock.getDateTime();

// For leading zero look to DS3231_dateformat example

Serial.print("Raw data: ");
Serial.print(dt.year); Serial.print("-");
Serial.print(dt.month); Serial.print("-");
Serial.print(dt.day); Serial.print(" ");
Serial.print(dt.hour); Serial.print(":");
Serial.print(dt.minute); Serial.print(":");
Serial.print(dt.second); Serial.println("");

delay(1000);
}

What's wrong?

I'm going to ask you to post some additional information that might help us to identify the problem.

Please do this:

  1. When you encounter an error, you'll see a button on the right side of the orange bar in the Arduino IDE: Copy error messages (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button.
  2. Open a forum reply here by clicking the Reply button.
  3. Click the </> icon on the post composer toolbar. This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block
  4. Press Ctrl+V. This will paste the compilation output into the code block.
  5. Move the cursor outside of the code block markup before you add any additional text to your reply.
  6. Click the Reply button to post the output.

Please also be careful to post code in the same way. You can see that, because you didn't post your code correctly, it was corrupted, which can lead to confusion and wasted time.

Arduino:1.8.15 (Mac OS X), Board:"Arduino Uno"

OLED_1:13:1: error: 'RTCDateTime' does not name a type; did you mean 'DateTime'?
RTCDateTime dt;
^~~~~~~~~~~
DateTime
/Users/h.c.m.raaijmaakers/Documents/Arduino/OLED_1/OLED_1.ino: In function 'void setup()':
OLED_1:21:7: error: 'class DS3231' has no member named 'begin'
clock.begin();
^~~~~
OLED_1:24:7: error: 'class DS3231' has no member named 'setDateTime'; did you mean 'setDate'?
clock.setDateTime(DATE, TIME);
^~~~~~~~~~~
setDate
OLED_1:24:19: error: 'DATE' was not declared in this scope
clock.setDateTime(DATE, TIME);
^~~~
/Users/h.c.m.raaijmaakers/Documents/Arduino/OLED_1/OLED_1.ino:24:19: note: suggested alternative: 'ADATE'
clock.setDateTime(DATE, TIME);
^~~~
ADATE
OLED_1:24:25: error: 'TIME' was not declared in this scope
clock.setDateTime(DATE, TIME);
^~~~
/Users/h.c.m.raaijmaakers/Documents/Arduino/OLED_1/OLED_1.ino:24:25: note: suggested alternative: 'FILE'
clock.setDateTime(DATE, TIME);
^~~~
FILE
/Users/h.c.m.raaijmaakers/Documents/Arduino/OLED_1/OLED_1.ino: In function 'void loop()':
OLED_1:29:1: error: 'dt' was not declared in this scope
dt = clock.getDateTime();
^~
OLED_1:29:12: error: 'class DS3231' has no member named 'getDateTime'; did you mean 'getDate'?
dt = clock.getDateTime();
^~~~~~~~~~~
getDate
exit status 1
'RTCDateTime' does not name a type; did you mean 'DateTime'?

Dit rapport zou meer informatie bevatten met
"Uitgebreide uitvoer weergeven tijden compilatie"
optie aan in Bestand -> Voorkeuren.

This error is probably caused by having a different library installed than the one your sketch code was written for. You should open the library's examples from the Arduino IDE's File > Examples menu and study them to learn how to use the library correctly.

What did you do, copy the corrupted sketch code you posted on the forum? I guess you get a taste of your own medicine.