-->
Page 1 of 4

error compiling for board Generic ESP8266 Module

PostPosted: Wed Mar 01, 2017 5:59 am
by Cary
Hi. Sorry if this question has cropped up again. I get the error message "error compiling for board Generic ESP8266 Module" when trying to compile the code provided with Marco Schwartz's book "Internet of things with ESP8266". I have tried the publisher, the author, and I have searched internet and have seen many people have asked the same question but I either cannot understand the answers or the answers do not work for me.
I have Arduino IDE 1.8.1 running on Windows 10

I have tried a couple of the example ESP8266 sketches that come with the IDE and they compile OK, eg blink

An example of code that will not compile is:
//dht_esp8266

#include <TFT.h>

// Import required libraries
#include "ESP8266WiFi.h"
#include <aREST.h>
#include "DHT.h"
#include <pgmspace.h>

// DHT11 sensor pins
#define DHTPIN 5
#define DHTTYPE DHT11

// Create aREST instance
aREST rest = aREST();

// Initialize DHT sensor
DHT dht(DHTPIN, DHTTYPE, 15);

// WiFi parameters
const char* ssid = "wifi-name";
const char* password = "wifi-pass";

// The port to listen for incoming TCP connections
#define LISTEN_PORT 80

// Create an instance of the server
WiFiServer server(LISTEN_PORT);

// Variables to be exposed to the API
float temperature;
float humidity;

void setup(void)
{
// Start Serial
Serial.begin(115200);

// Init DHT
dht.begin();

// Init variables and expose them to REST API
rest.variable("temperature", &temperature);
rest.variable("humidity", &humidity);

// Give name and ID to device
rest.set_id("1");
rest.set_name("esp8266");

// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");

// Start the server
server.begin();
Serial.println("Server started");

// Print the IP address
Serial.println(WiFi.localIP());

}

void loop() {

// Reading temperature and humidity
humidity = dht.readHumidity();
temperature = dht.readTemperature();

// Handle REST calls
WiFiClient client = server.available();
if (!client) {
return;
}
while (!client.available()) {
delay(1);
}
rest.handle(client);

}

This has got me stumped. I hope someone can help
Thanks
Cary

Re: error compiling for board Generic ESP8266 Module

PostPosted: Thu Mar 02, 2017 7:09 am
by jwmeyer
Please post the error that your getting.

Re: error compiling for board Generic ESP8266 Module

PostPosted: Thu Mar 02, 2017 12:56 pm
by Cary
Arduino: 1.8.1 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

C:\Program Files\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\Arduino\hardware -hardware C:\Users\Cary\AppData\Local\Arduino15\packages -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -tools C:\Users\Cary\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\Cary\Documents\Arduino\libraries -fqbn=esp8266:esp8266:generic:CpuFrequency=80,FlashFreq=40,FlashMode=dio,UploadSpeed=115200,FlashSize=512K64,ResetMethod=ck,Debug=Disabled,DebugLevel=None____ -ide-version=10801 -build-path C:\Users\Cary\AppData\Local\Temp\arduino_build_198982 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.esptool.path=C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.9 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -prefs=runtime.tools.mkspiffs.path=C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\0.1.2 -verbose C:\Users\Cary\Desktop\ESP8266 files\B05403_02_code\02\dht_esp8266\dht_esp8266.ino
C:\Program Files\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files\Arduino\hardware -hardware C:\Users\Cary\AppData\Local\Arduino15\packages -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -tools C:\Users\Cary\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\Cary\Documents\Arduino\libraries -fqbn=esp8266:esp8266:generic:CpuFrequency=80,FlashFreq=40,FlashMode=dio,UploadSpeed=115200,FlashSize=512K64,ResetMethod=ck,Debug=Disabled,DebugLevel=None____ -ide-version=10801 -build-path C:\Users\Cary\AppData\Local\Temp\arduino_build_198982 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.esptool.path=C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.9 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -prefs=runtime.tools.mkspiffs.path=C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\0.1.2 -verbose C:\Users\Cary\Desktop\ESP8266 files\B05403_02_code\02\dht_esp8266\dht_esp8266.ino
Using board 'generic' from platform in folder: C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0
Using core 'esp8266' from platform in folder: C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0
Detecting libraries used...
"C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\Cary\AppData\Local\Temp\arduino_build_198982/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DARDUINO=10801 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_ESP01" -DESP8266 "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\variants\generic" "C:\Users\Cary\AppData\Local\Temp\arduino_build_198982\sketch\dht_esp8266.ino.cpp" -o "nul"
"C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\Cary\AppData\Local\Temp\arduino_build_198982/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DARDUINO=10801 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_ESP01" -DESP8266 "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\variants\generic" "-IC:\Program Files\Arduino\libraries\TFT\src" "C:\Users\Cary\AppData\Local\Temp\arduino_build_198982\sketch\dht_esp8266.ino.cpp" -o "nul"
"C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\Cary\AppData\Local\Temp\arduino_build_198982/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DARDUINO=10801 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_ESP01" -DESP8266 "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\variants\generic" "-IC:\Program Files\Arduino\libraries\TFT\src" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SPI" "C:\Users\Cary\AppData\Local\Temp\arduino_build_198982\sketch\dht_esp8266.ino.cpp" -o "nul"
"C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\Cary\AppData\Local\Temp\arduino_build_198982/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DARDUINO=10801 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_ESP01" -DESP8266 "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\variants\generic" "-IC:\Program Files\Arduino\libraries\TFT\src" "-IC:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SPI" "C:\Users\Cary\AppData\Local\Temp\arduino_build_198982\sketch\dht_esp8266.ino.cpp" -o "C:\Users\Cary\AppData\Local\Temp\arduino_build_198982\preproc\ctags_target_for_gcc_minus_e.cpp"
In file included from C:\Program Files\Arduino\libraries\TFT\src/TFT.h:37:0,

from C:\Users\Cary\Desktop\ESP8266 files\B05403_02_code\02\dht_esp8266\dht_esp8266.ino:2:

C:\Program Files\Arduino\libraries\TFT\src/utility/Adafruit_ST7735.h:30:26: fatal error: avr/pgmspace.h: No such file or directory

#include <avr/pgmspace.h>

^

compilation terminated.

Multiple libraries were found for "SPI.h"
Used: C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SPI
Not used: C:\Program Files\Arduino\libraries\SPI
Using library TFT at version 1.0.6 in folder: C:\Program Files\Arduino\libraries\TFT
Using library SPI at version 1.0 in folder: C:\Users\Cary\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SPI
exit status 1
Error compiling for board Generic ESP8266 Module.

Re: error compiling for board Generic ESP8266 Module

PostPosted: Thu Mar 02, 2017 12:59 pm
by Cary
thanks for your reply, jwmeyer. much appreciated