Error compiling for NodeMCU 0.9 (ESP-12 Module) card

Hello, I have been doing a degree project and I need to configure an 8 channel relay with an esp8622, I have had several problems when programming it and when I thought that everything was fine, it gave me this error:

c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient5writeEh':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:207: multiple definition of `_ZN10WiFiClient5writeEh'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:74: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient4peekEv':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:276: multiple definition of `_ZN10WiFiClient4peekEv'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:133: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClientcvbEv':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:341: multiple definition of `_ZN10WiFiClientcvbEv'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:185: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient7connectEPKct':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:129: multiple definition of `_ZN10WiFiClient7connectEPKct'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:41: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient9availableEv':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:245: multiple definition of `_ZN10WiFiClient9availableEv'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:105: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient6statusEv':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:335: multiple definition of `_ZN10WiFiClient6statusEv'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:176: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient9connectedEv':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:326: multiple definition of `_ZN10WiFiClient9connectedEv'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:162: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient5writeEPKhj':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:212: multiple definition of `_ZN10WiFiClient5writeEPKhj'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:78: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient4readEPhj':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:266: multiple definition of `_ZN10WiFiClient4readEPhj'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:124: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient4readEv':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:258: multiple definition of `_ZN10WiFiClient4readEv'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:114: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN5PrintC4Ev':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:46: multiple definition of `_ZN10WiFiClientC2Ev'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:46: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN5PrintC4Ev':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:46: multiple definition of `_ZN10WiFiClientC1Ev'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:46: first defined here
c:/users/bibia/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient7connectE9IPAddresst':
C:\Users\bibia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:144: multiple definition of `_ZN10WiFiClient7connectE9IPAddresst'; libraries\WiFi\WiFiClient.cpp.o:C:\Users\bibia\Desktop\arduino-1.8.16\libraries\WiFi\src/WiFiClient.cpp:50: first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compilando para la tarjeta NodeMCU 0.9 (ESP-12 Module).`

`
I need help please, I would really appreciate someone's collaboration, I link the code just in case:

/*********

*********/

// Import required libraries
#include "WiFi.h"
#include "ESPAsyncWebServer.h"

// Set to true to define Relay as Normally Open (NO)
#define RELAY_NO    true

// Set number of relays
#define NUM_RELAYS  5

// Assign each GPIO to a relay
int relayGPIOs[NUM_RELAYS] = {D8, D7, D6, D5, D4};

// Replace with your network credentials
char* ssid = "Alejo";
const char* password = "manuelalejo";

const char* PARAM_INPUT_1 = "relay";  
const char* PARAM_INPUT_2 = "state";

// Create AsyncWebServer object on port 80
AsyncWebServer server(80);

const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style>
    html {font-family: Arial; display: inline-block; text-align: center;}
    h2 {font-size: 3.0rem;}
    p {font-size: 3.0rem;}
    body {max-width: 600px; margin:0px auto; padding-bottom: 25px;}
    .switch {position: relative; display: inline-block; width: 120px; height: 68px} 
    .switch input {display: none}
    .slider {position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; border-radius: 34px}
    .slider:before {position: absolute; content: ""; height: 52px; width: 52px; left: 8px; bottom: 8px; background-color: #fff; -webkit-transition: .4s; transition: .4s; border-radius: 68px}
    input:checked+.slider {background-color: #2196F3}
    input:checked+.slider:before {-webkit-transform: translateX(52px); -ms-transform: translateX(52px); transform: translateX(52px)}
  </style>
</head>
<body>
  <h2>ESP Web Server</h2>
  %BUTTONPLACEHOLDER%
<script>function toggleCheckbox(element) {
  var xhr = new XMLHttpRequest();
  if(element.checked){ xhr.open("GET", "/update?relay="+element.id+"&state=1", true); }
  else { xhr.open("GET", "/update?relay="+element.id+"&state=0", true); }
  xhr.send();
}</script>
</body>
</html>
)rawliteral";

// Replaces placeholder with button section in your web page
String processor(const String& var){
  //Serial.println(var);
  if(var == "BUTTONPLACEHOLDER"){
    String buttons ="";
    for(int i=1; i<=NUM_RELAYS; i++){
      String relayStateValue = relayState(i);
      buttons+= "<h4>Relay #" + String(i) + " - GPIO " + relayGPIOs[i-1] + "</h4><label class=\"switch\"><input type=\"checkbox\" onchange=\"toggleCheckbox(this)\" id=\"" + String(i) + "\" "+ relayStateValue +"><span class=\"slider\"></span></label>";
    }
    return buttons;
  }
  return String();
}

String relayState(int numRelay){
  if(RELAY_NO){
    if(digitalRead(relayGPIOs[numRelay-1])){
      return "";
    }
    else {
      return "checked";
    }
  }
  else {
    if(digitalRead(relayGPIOs[numRelay-1])){
      return "checked";
    }
    else {
      return "";
    }
  }
  return "";
}

void setup(){
  // Serial port for debugging purposes
  Serial.begin(115200);

  // Set all relays to off when the program starts - if set to Normally Open (NO), the relay is off when you set the relay to HIGH
  for(int i=1; i<=NUM_RELAYS; i++){
    pinMode(relayGPIOs[i-1], OUTPUT);
    if(RELAY_NO){
      digitalWrite(relayGPIOs[i-1], HIGH);
    }
    else{
      digitalWrite(relayGPIOs[i-1], LOW);
    }
  }
  
  // Connect to Wi-Fi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi..");
  }

  // Print ESP32 Local IP Address
  Serial.println(WiFi.localIP());

  // Route for root / web page
  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/html", index_html, processor);
  });

  // Send a GET request to <ESP_IP>/update?relay=<inputMessage>&state=<inputMessage2>
  server.on("/update", HTTP_GET, [] (AsyncWebServerRequest *request) {
    String inputMessage;
    String inputParam;
    String inputMessage2;
    String inputParam2;
    // GET input1 value on <ESP_IP>/update?relay=<inputMessage>
    if (request->hasParam(PARAM_INPUT_1) & request->hasParam(PARAM_INPUT_2)) {
      inputMessage = request->getParam(PARAM_INPUT_1)->value();
      inputParam = PARAM_INPUT_1;
      inputMessage2 = request->getParam(PARAM_INPUT_2)->value();
      inputParam2 = PARAM_INPUT_2;
      if(RELAY_NO){
        Serial.print("NO ");
        digitalWrite(relayGPIOs[inputMessage.toInt()-1], !inputMessage2.toInt());
      }
      else{
        Serial.print("NC ");
        digitalWrite(relayGPIOs[inputMessage.toInt()-1], inputMessage2.toInt());
      }
    }
    else {
      inputMessage = "No message sent";
      inputParam = "none";
    }
    Serial.println(inputMessage + inputMessage2);
    request->send(200, "text/plain", "OK");
  });
  // Start server
  server.begin();
}
  
void loop() {

}

thanks

Hi @mh0322
there is some incompatibility between these two libraries.
See, if you compile this empty sketch you will get the same error.

#include "WiFi.h"
#include "ESPAsyncWebServer.h"

void setup(){
}
void loop() {
}

Search the web to see if you can find any tips about this incompatibility.

PS: I FInd this:
For ESP8266 it requires ESPAsyncTCP To use this library you might need to have the latest git versions of ESP8266

RV mineirin

Of course @ruilviana is correct. First of all "WiFi.h" is not for an ESP8266.
After installing ESPAsyncWebServer.h and ESPAsyncTCP.h and including these libraries and the correct Wifi library like this :

// Import required libraries
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>

The code compiles (be it with a warning for not using 'const' in front of you ssid char. Don't include your actual Wifi credentials in a post ! )

Perhaps you mean:
#include "ESP8266WiFi.h"

Which ESPAsyncWebServer library are you using and have you tried the library examples for that library? Most of the ESPAsyncWebServer libraries I was able to find are for the ESP32 processor, not ESP8266.