exit status 1: Error compiling for board Arduino/Genuino Uno

I'm getting the error message in the title and have no idea what it's on about- the board is connected. I'm using an ESP8266 to connect to wifi so it might be a problem with that?
Thanks in advance!

#include <fauxmoESP.h>

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "fauxmoESP.h"
#include <Servo.h> 

#define SERIAL_BAUDRATE 115200

#define WIFI_SSID "********"
#define WIFI_PASS "*******"

#define app1 "door close"

fauxmoESP fauxmo; 

int servoPin = 7;
int bPin = 8;
Servo Servo1;

void wifiSetup() {
  
  WiFi.mode(WIFI_STA);

  WiFi.begin(WIFI_SSID, WIFI_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(100);
  }
WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());
}

void setup() {
  // put your setup code here, to run once:
Servo1.attach(servoPin);
Servo1.write(-100);
  pinMode(bPin, INPUT); 

Serial.begin(SERIAL_BAUDRATE);
  wifiSetup();

  fauxmo.createServer(true); // not needed, this is the default value
  fauxmo.setPort(80); // This is required for gen3 devices

  fauxmo.enable(true);
  fauxmo.addDevice(app1);

fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {
  device_id, device_name, state ? "ON" : "OFF", value);
    if ( (strcmp(device_name, app1) == 0) ) {
      if (state) {
        Serial.print("a");
      } else {
        Serial.print("b");
      }
    }

  });
}

void loop() {
  // put your main code here, to run repeatedly:
int pushed = digitalRead(bPin);

if (pushed == HIGH){
go();
}

  fauxmo.handle();

  static unsigned long last = millis();
  if (millis() - last > 5000) {
    last = millis();
  }
  
  if(Serial.available() > 0)  
  {
    data = Serial.read();      
    Serial.print(data);        
    Serial.print("\n");        
    if(data == 'a')            
go();
    else if(data == 'b')       
      digitalWrite(4, LOW);      
  }                            
}

void go() {
Servo1.write(90);
delay(1000);
Servo1.write(-90);
delay(1000);
}

Is that the entire error message? In the IDE, there will be a "copy error message" button in the lower right of the IDE window. Copy the error and paste into a new post.

        Serial.print("b");
      }
    }

  }); // **************  this is probably not right

}

Your code would be easier to follow if it were indented in a standard manner. The IDE has the autoformat tool (ctrl-t or Tools, Auto Format) to do just that.

Change

});

To

}

By removing the ) and ;.

Ib the IDE go to File, Preferences and enable compiler warnings to get warnings on tis kind of error.

If the code won't compile, post the entire error message.

Hello CormAlan,

CormAlan:
I'm using an ESP8266 to connect .......

Have you check in the IDE menu Tools > Board ?

Regards ,
bidouilleelec

I downloaded a "flashing tool" for the esp8266 to try and get it to work, and it gave me new options for boards, but when I used any of them (including the normal Arduino UNO/genuino one) it gave me this error message:

Arduino: 1.8.10 (Mac OS X), Board: "Arduino/Genuino Uno"

Build options changed, rebuilding all
In file included from /Users/USER/Documents/Arduino/libraries/ESP8266WiFi/src/WiFiClientSecure.h:41:0,
from /Users/USER/Documents/Arduino/libraries/ESP8266WiFi/src/WiFiServerSecure.h:20,
from /Users/USER/Documents/Arduino/servo1/servo1.ino:1:
/Users/USER/Documents/Arduino/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.h:26:10: fatal error: vector: No such file or directory
#include
^~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

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

Did you install the plug-in for the ESP8266 into the IDE as described in the beginners guide to ESP8266?

Then choose your ESP board and set the options in the Boards menu. You cannot load Uno code to an ESP8266.

Hello CormAlan,

Quote from: CormAlan on Feb 07, 2020, 07:27 pm

I'm using an ESP8266 to connect .......

When you check in the IDE menu Tools > Board , what do you see ?

Regards ,
bidouilleelec

Okay so I went into the tools, downloaded the board for the esp8266 and set the board to "Generic ESP8266 module", and it's giving me a new error message that reads:

Arduino: 1.8.10 (Mac OS X), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Build options changed, rebuilding all
Multiple libraries were found for "WiFiServerSecure.h"
 Used: /Users/USER/Documents/Arduino/libraries/ESP8266WiFi
 Not used: /Users/USER/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/libraries/ESP8266WiFi
Multiple libraries were found for "Servo.h"
 Used: /Users/USER/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/libraries/Servo
 Not used: /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/libraries/Servo
fork/exec /Users/USER/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3: no such file or directory
Error compiling for board Generic ESP8266 Module.

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

Hello CormAlan,

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

1/ Have you set "Show output during" options in File -> Preferences
2/ What are the exactt and complete references of your board ?
3/ Could you upload a screenshot of "File -> Preferences" window ?

Regards,
bidouilleelec

Do not post your ssid and pass on a public forum:

#define WIFI_SSID "****"
#define WIFI_PASS "****"

Edit your messages before it's too late...

Okay I've attached a screencap of the preferences, and when I click "get board info" it gives me this:

BN: Arduino/Genuino Uno
VID: 0x2341
PID: 0x0043
SN: 55736323839351D090E1

Please post a wiring diagram of your setup. What board is selected in the IDE Tools, Boards menu? What board do you have connected to your computer?

Ok. The Arduino is connected to the computer, and the ESP8266 is connected to the Arduino. I've selected the Generic ESP8266 Module board in "Tools". The connection between the Arduino and esp8266 is this:

Esp8266 RX => Arduino I/O pin 0
Esp8266 Tx => Arduino I/O pin 1
Esp8266 VCC(3.3V) => 3.3V source
Esp8266 EN => 3.3V Source
Esp8266 Ground => Ground

Hello

CormAlan:
I'm getting the error message in the title and have no idea what it's on about- the board is connected. I'm using an ESP8266 to connect to wifi so it might be a problem with that?

Okay I've attached a screencap of the preferences, and when I click "get board info" it gives me this:

BN: Arduino/Genuino Uno
VID: 0x2341
PID: 0x0043
SN: 55736323839351D090E1

Are you using a board equiped witn an ESP8266 or an Arduino/Genuino Uno ?

It seems you are using an Arduino/Genuino Uno. So in Tool/Board window of the IDE select "Arduino/Genuino Uno".
You can't use
#include <ESP8266WiFi.h>
on an UNO.
Regards,
bidouilleelec

CormAlan:
Ok. The Arduino is connected to the computer, and the ESP8266 is connected to the Arduino. I've selected the Generic ESP8266 Module board in "Tools". The connection between the Arduino and esp8266 is this:

Esp8266 RX => Arduino I/O pin 0
Esp8266 Tx => Arduino I/O pin 1
Esp8266 VCC(3.3V) => 3.3V source
Esp8266 EN => 3.3V Source
Esp8266 Ground => Ground

What are the exact and complete references of your ESP8266 board ?

The code in your first post is ESP8266 code. As bidouilleelec pointed out, that will not work on an Uno and code written for an Uno will very likely not work with an ESP8266.

My I suggest, while you are developing the code, that you use a software serial port for the ESP so that you have the hardware serial (USB) free for uploading code, program output and debugging. Software serial ports do not work at more than 38400 baud so you need to take that into account.

Ok I removed the include statement and set the board to Arduino, and the error message has switched to this:

Arduino: 1.8.10 (Mac OS X), Board: "Arduino/Genuino Uno"

/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware -hardware /Users/****/Library/Arduino15/packages -tools /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/tools-builder -tools /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/****/Library/Arduino15/packages -built-in-libraries /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/libraries -libraries /Users/****/Documents/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10810 -build-path /var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/arduino_build_559727 -warnings=all -build-cache /var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/arduino_cache_789633 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -verbose /Users/****/Documents/Arduino/servo1/servo1.ino
/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware -hardware /Users/****/Library/Arduino15/packages -tools /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/tools-builder -tools /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/****/Library/Arduino15/packages -built-in-libraries /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/libraries -libraries /Users/****/Documents/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10810 -build-path /var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/arduino_build_559727 -warnings=all -build-cache /var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/arduino_cache_789633 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr -verbose /Users/****/Documents/Arduino/servo1/servo1.ino
Using board 'uno' from platform in folder: /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/arduino/avr
Using core 'arduino' from platform in folder: /private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/arduino/avr
Build options changed, rebuilding all
Detecting libraries used...
/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard /var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/arduino_build_559727/sketch/servo1.ino.cpp -o /dev/null
/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/private/var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/AppTranslocation/2EA1C980-F880-4104-A784-2EAE78323746/d/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/****/Documents/Arduino/libraries/ESP8266WiFi/src /var/folders/k9/_nyp1bq96nn4053t87qkhc100000gn/T/arduino_build_559727/sketch/servo1.ino.cpp -o /dev/null
In file included from /Users/****/Documents/Arduino/libraries/ESP8266WiFi/src/WiFiClientSecure.h:41:0,
                 from /Users/****/Documents/Arduino/libraries/ESP8266WiFi/src/WiFiServerSecure.h:20,
                 from /Users/****/Documents/Arduino/servo1/servo1.ino:1:
/Users/****/Documents/Arduino/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.h:26:10: fatal error: vector: No such file or directory
 #include <vector>
          ^~~~~~~~
compilation terminated.
Using library ESP8266WiFi at version 1.0 in folder: /Users/****/Documents/Arduino/libraries/ESP8266WiFi 
exit status 1
Error compiling for board Arduino/Genuino Uno.

Sorry about all of these issues I'm fairly new here

Hello CormAlan

Are you trying to reproduce something like that ?

Your code :

void loop() {
  // put your main code here, to run repeatedly:
int pushed = digitalRead(bPin);

if (pushed == HIGH){
go();
}

  fauxmo.handle();

  static unsigned long last = millis();
  if (millis() - last > 5000) {
    last = millis();
  }
 
  if(Serial.available() > 0) 
  {
    data = Serial.read();     
    Serial.print(data);       
    Serial.print("\n");       
    if(data == 'a')           
go();
    else if(data == 'b')       
      digitalWrite(4, LOW);     
  }                           
}

It seems to me that you are mixing two sketches, one intended to be loaded on an ESP8266 and the other on a UNO to try to make a single sketch. That does not make sense.

Am I right ?

Further more :

fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {
  device_id, device_name, state ? "ON" : "OFF", value);

in your code will not compile.

Maybe it should be something like that :

fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {
  Serial.printf("[MAIN] Device #%d (%s) state: %s value: %d\n", 
 device_id, device_name, state ? "ON" : "OFF", value);

Regards,
bidouilleelec

Yeah, that's the exact tutorial I was using! Clearly, I don't know what I'm doing. Can't UNO code be mixed with the ESP8266 or do I need to disconnect it first?