[SOLVED]ESP8266 LOLIN(WEMOS) D1 Mini compilation error

I get a compilation error when trying to compile this code for an ESP8266 LOLIN(WEMOS) D1 Mini:

#include <ESP8266WiFi.h>

// Set WiFi credentials
#define WIFI_SSID "YOUR WIFI NETWORK SSID"
#define WIFI_PASS "YOUR WIFI PASSWORD"

void setup() {
  // Setup serial port
  Serial.begin(115200);
  Serial.println();

  // Begin WiFi
  WiFi.begin(WIFI_SSID, WIFI_PASS);

  // Connecting to WiFi...
  Serial.print("Connecting to ");
  Serial.print(WIFI_SSID);
  // Loop continuously while WiFi is not connected
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(100);
    Serial.print(".");
  }

  // Connected to WiFi
  Serial.println();
  Serial.print("Connected! IP address: ");
  Serial.println(WiFi.localIP());

}

The code simply tries to connect to WiFi and is found in this tutorial.

The error message when trying to compile it in Arduino Web Editor is:

/home/builder/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: /tmp/core/core_5220fe51ed78022ad7915b88f9a42dc2.a(core_esp8266_main.cpp.o): in function `do_global_ctors':

/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/core_esp8266_main.cpp:149: undefined reference to `loop'

/home/builder/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: /tmp/core/core_5220fe51ed78022ad7915b88f9a42dc2.a(core_esp8266_main.cpp.o): in function `loop_wrapper()':

/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/core_esp8266_main.cpp:120: undefined reference to `loop'

collect2: error: ld returned 1 exit status

exit status 1

I've also tried in Arduino IDE (desktop), but get an almost similar error.
Thanks.

That's not a compilation error, that's a linker error.

undefined reference to `loop'

You have no loop() function

Indeed, there was no loop() function.

Added it and it compiles!