Skip to content

FPSTR not portable between ESP8266 and ESP32 #7940

@dok-net

Description

@dok-net

Board

ESP32 Dev Module

Device Description

DevKitC

Version

latest master (checkout manually)

IDE Name

Arduino IDE

Operating System

Windows 10

Description

After all these years, the following MCVE still does not compile without changes on both ESP8266 Core master and ESP32 Core master.
Shouldn't FPSTR correctly be defined as a noop on ESP32 instead of ... __FlashStringHelper ...?

Sketch

#if defined(ESP8266) #include <ESP8266mDNS.h> #elif defined(ESP32) #include <ESPmDNS.h> #endif static const char MDNSNAME[] PROGMEM = "esp"; // your device's MDNS host name void setup() { MDNS.begin(FPSTR(MDNSNAME)); } void loop() { }

Debug Message

Compiling on ESP8266 works, on ESP32 fails:

fpstr_issue.ino: In function void setup() fpstr_issue.ino: 11:31: error: no matching function for call to 'MDNSResponder::begin(const __FlashStringHelper*) MDNS.begin(FPSTR(MDNSNAME)) fpstr_issue.ino:4: In file included from ESPmDNS.h:57: note candidate bool MDNSResponder begin(const char*) bool begin(const char* hostName) ^~~~~ ESPmDNS.h:57: note no known conversion for argument 1 from const __FlashStringHelper* to const char* Error compiling project sources Build failed for project 'fpstr_issue' 
 ### I have checked existing issues, online documentation and the Troubleshooting Guide - [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide. 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions