Closed
Description
This code compiles on Uno and ESP8266 but produces compiler errors on ESP32.
void setup() {
Serial.begin(115200);
Serial.println(F("hello world"));
}
void loop() {
}
In file included from /home/me/arduino-esp32/hardware/expressif/esp32/cores/esp32/Arduino.h:52:0,
from /tmp/buildad9bb1d844c0ed80cdda279063404da3.tmp/sketch/pgmstring.ino.cpp:1:
/home/me/arduino-esp32/portable/sketchbook/pgmstring/pgmstring.ino: In function 'void setup()':
/home/me/arduino-esp32/hardware/expressif/esp32/cores/esp32/WString.h:39:53: error: 'PSTR' was not declared in this scope
#define F(string_literal) (FPSTR(PSTR(string_literal)))
^
/home/me/arduino-esp32/hardware/expressif/esp32/cores/esp32/WString.h:38:76: note: in definition of macro 'FPSTR'
#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
^
/home/me/arduino-esp32/portable/sketchbook/pgmstring/pgmstring.ino:3:18: note: in expansion of macro 'F'
Serial.println(F("hello world"));
^
exit status 1
Including pgmspace.h (not necessary on Uno and ESP8266) produces the following.
"/home/me/arduino-esp32/hardware/expressif/esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++" -DESP_PLATFORM -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/config" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/bt" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/driver" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/esp32" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/freertos" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/log" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/newlib" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/nvs_flash" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/spi_flash" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/tcpip_adapter" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/expat" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/json" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/mbedtls" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/nghttp" "-I/home/me/arduino-esp32/hardware/expressif/esp32/tools/sdk/include/lwip" -c -w -Os -g3 -Wpointer-arith -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -fno-rtti -ffunction-sections -fdata-sections -mlongcalls -nostdlib -MMD -std=gnu++11 -fno-exceptions -fstrict-volatile-bitfields -DF_CPU=160000000L -DARDUINO=10609 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 -DESP32 "-I/home/me/arduino-esp32/hardware/expressif/esp32/cores/esp32" "-I/home/me/arduino-esp32/hardware/expressif/esp32/variants/esp32" "/tmp/buildad9bb1d844c0ed80cdda279063404da3.tmp/sketch/pgmstring.ino.cpp" -o "/tmp/buildad9bb1d844c0ed80cdda279063404da3.tmp/sketch/pgmstring.ino.cpp.o"
In file included from /home/me/arduino-esp32/portable/sketchbook/pgmstring/pgmstring.ino:1:0:
/home/me/arduino-esp32/hardware/expressif/esp32/cores/esp32/pgmspace.h:22:14: error: conflicting declaration 'typedef char __FlashStringHelper'
typedef char __FlashStringHelper;
^
In file included from /home/me/arduino-esp32/hardware/expressif/esp32/cores/esp32/Arduino.h:52:0,
from /tmp/buildad9bb1d844c0ed80cdda279063404da3.tmp/sketch/pgmstring.ino.cpp:1:
/home/me/arduino-esp32/hardware/expressif/esp32/cores/esp32/WString.h:37:7: error: 'class __FlashStringHelper' has a previous declaration as 'class __FlashStringHelper'
class __FlashStringHelper;
^
exit status 1
Error compiling for board ESP32 Dev Module.
Metadata
Metadata
Assignees
Labels
No labels