Error with ESP8266 Libray.

Hi I am trying to compile this code to work with an ESP8266 chip. I have tried installing the libraries and reinstalling them but no matter what I am still getting the same error message. I have searched similar threads but I still am unsure what is wrong.

Attached is my code and my error message.

#include <Arduino.h>
#ifdef ESP32
    #include <WiFi.h>
#else
    #include <ESP8266WiFi.h>
#endif
#include "fauxmoESP.h"

// Rename the credentials.sample.h file to credentials.h and 
// edit it according to your router configuration
#include "credentials.h"

fauxmoESP fauxmo;

// -----------------------------------------------------------------------------

#define SERIAL_BAUDRATE     115200

#define LED_YELLOW          4
#define LED_GREEN           5
#define LED_BLUE            0
#define LED_PINK            2
#define LED_WHITE           15

#define ID_YELLOW           "yellow lamp"
#define ID_GREEN            "green lamp"
#define ID_BLUE             "blue lamp"
#define ID_PINK             "pink lamp"
#define ID_WHITE            "white lamp"

// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// Wifi
// -----------------------------------------------------------------------------

void wifiSetup() {

    // Set WIFI module to STA mode
    WiFi.mode(WIFI_STA);

    // Connect
    Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
    WiFi.begin(WIFI_SSID, WIFI_PASS);

    // Wait
    while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(100);
    }
    Serial.println();

    // Connected!
    Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());

}

void setup() {

    // Init serial port and clean garbage
    Serial.begin(SERIAL_BAUDRATE);
    Serial.println();
    Serial.println();

    // LEDs
    pinMode(LED_YELLOW, OUTPUT);
    pinMode(LED_GREEN, OUTPUT);
    pinMode(LED_BLUE, OUTPUT);
    pinMode(LED_PINK, OUTPUT);
    pinMode(LED_WHITE, OUTPUT);
    digitalWrite(LED_YELLOW, LOW);
    digitalWrite(LED_GREEN, LOW);
    digitalWrite(LED_BLUE, LOW);
    digitalWrite(LED_PINK, LOW);
    digitalWrite(LED_WHITE, LOW);

    // Wifi
    wifiSetup();

    // By default, fauxmoESP creates it's own webserver on the defined port
    // The TCP port must be 80 for gen3 devices (default is 1901)
    // This has to be done before the call to enable()
    fauxmo.createServer(true); // not needed, this is the default value
    fauxmo.setPort(80); // This is required for gen3 devices

    // You have to call enable(true) once you have a WiFi connection
    // You can enable or disable the library at any moment
    // Disabling it will prevent the devices from being discovered and switched
    fauxmo.enable(true);

    // You can use different ways to invoke alexa to modify the devices state:
    // "Alexa, turn yellow lamp on"
    // "Alexa, turn on yellow lamp
    // "Alexa, set yellow lamp to fifty" (50 means 50% of brightness, note, this example does not use this functionality)

    // Add virtual devices
    fauxmo.addDevice(ID_YELLOW);
    fauxmo.addDevice(ID_GREEN);
    fauxmo.addDevice(ID_BLUE);
    fauxmo.addDevice(ID_PINK);
    fauxmo.addDevice(ID_WHITE);

    fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {
        
        // Callback when a command from Alexa is received. 
        // You can use device_id or device_name to choose the element to perform an action onto (relay, LED,...)
        // State is a boolean (ON/OFF) and value a number from 0 to 255 (if you say "set kitchen light to 50%" you will receive a 128 here).
        // Just remember not to delay too much here, this is a callback, exit as soon as possible.
        // If you have to do something more involved here set a flag and process it in your main loop.
        
        Serial.printf("[MAIN] Device #%d (%s) state: %s value: %d\n", device_id, device_name, state ? "ON" : "OFF", value);

        // Checking for device_id is simpler if you are certain about the order they are loaded and it does not change.
        // Otherwise comparing the device_name is safer.

        if (strcmp(device_name, ID_YELLOW)==0) {
            digitalWrite(LED_YELLOW, state ? HIGH : LOW);
        } else if (strcmp(device_name, ID_GREEN)==0) {
            digitalWrite(LED_GREEN, state ? HIGH : LOW);
        } else if (strcmp(device_name, ID_BLUE)==0) {
            digitalWrite(LED_BLUE, state ? HIGH : LOW);
        } else if (strcmp(device_name, ID_PINK)==0) {
            digitalWrite(LED_PINK, state ? HIGH : LOW);
        } else if (strcmp(device_name, ID_WHITE)==0) {
            digitalWrite(LED_WHITE, state ? HIGH : LOW);
        }

    });

}

void loop() {

    // fauxmoESP uses an async TCP server but a sync UDP server
    // Therefore, we have to manually poll for UDP packets
    fauxmo.handle();

    // This is a sample code to output free heap every 5 seconds
    // This is a cheap way to detect memory leaks
    static unsigned long last = millis();
    if (millis() - last > 5000) {
        last = millis();
        Serial.printf("[MAIN] Free heap: %d bytes\n", ESP.getFreeHeap());
    }

    // If your device state is changed by any other means (MQTT, physical button,...)
    // you can instruct the library to report the new state to Alexa on next request:
    // fauxmo.setState(ID_YELLOW, true, 255);

}
Arduino: 1.8.8 (Windows 10), Board: "SparkFun ESP8266 Thing Dev, 80 MHz, Flash, Disabled, 512K (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Build options changed, rebuilding all
In file included from C:\Users\nickm\Google Drive\Senior Year\Arduino\IoT\IoT.ino:7:0:

Multiple libraries were found for "ESP8266WiFi.h"
C:\Users\nickm\Documents\Arduino\libraries\xoseperez-fauxmoesp-f60c46d80f9b\src/fauxmoESP.h:60:29: fatal error: ESPAsyncTCP.h: No such file or directory

 Used: C:\Users\nickm\Documents\Arduino\libraries\ESP8266WiFi
     #include <ESPAsyncTCP.h>

 Not used: C:\Users\nickm\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266WiFi
                             ^

compilation terminated.

exit status 1
Error compiling for board SparkFun ESP8266 Thing Dev.

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

The missing library is "ESPAsyncTCP". As explained in the fauxmoESP documentation, you can get it here:

You seem to have installed the "ESP8266WiF"i library to C:\Users\nickm\Documents\Arduino\libraries\ESP8266WiFi. That is a bad idea because that library is already part of the "ESP8266 core for Arduino" boards platform and you must make sure to use the exact version of the library that goes with the version of the boards platform you have installed.

I recommend deleting the C:\Users\nickm\Documents\Arduino\libraries\ESP8266WiFi folder. Please be very careful when deleting things from your computer. When in doubt, back up!

Hi, so I completely reinstalled Arduino and reset my libraries. I reinstalled the fauxmoesp and ESPAsync libraries with their zips through the library manager. Next I installed the ESP8622 board through the board manager but I am getting a new error message

C:\Users\nickm\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-ar: unable to rename 'C:\Users\nickm\AppData\Local\Temp\arduino_build_17452\libraries\ESP8266WiFi\ESP8266WiFi.a'; reason: File exists

Using library ESP8266WiFi at version 1.0 in folder: C:\Users\nickm\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266WiFi 
Using library xoseperez-fauxmoesp-f60c46d80f9b at version 3.1.0 in folder: C:\Users\nickm\Documents\Arduino\libraries\xoseperez-fauxmoesp-f60c46d80f9b 
Using library ESPAsyncTCP-master at version 1.2.0 in folder: C:\Users\nickm\Documents\Arduino\libraries\ESPAsyncTCP-master 
exit status 1
Error compiling for board Generic ESP8266 Module.

Do I need to install the ESP8622 library separately or is it enough to just to install the board with the board manager?

All your libraries are installed properly now. The error is caused by something completely unrelated.

This sort of error could be caused by your antivirus software. Try TEMPORARILY disabling your antivirus for a single compilation to see if the problem goes away, then turn the antivirus back on. If the problem doesn't occur with the antivirus off you will need to adjust the settings of your antivirus to whitelist the appropriate file, folder, or process so it doesn't interfere with compilation.

is ESP-core 2.5.0 out of the beta stage yet ? I still had issues with it when installed it last and rolling back to 2.4.0 fixed it.

Yes, it's out of beta.

Deva_Rishi:
is ESP-core 2.5.0 out of the beta stage yet ? I still had issues with it when installed it last and rolling back to 2.4.0 fixed it.

use 2.4.2
2.4.0 has a memory leak