1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.55k stars 782 forks source link

'to_string' is not a member of 'std' in ZgatewayRF.ino #1946

Closed reimerp closed 1 week ago

reimerp commented 3 months ago

Before submitting a problem please check the troubleshooting section https://docs.openmqttgateway.com/upload/troubleshoot.html

Describe the bug Compile Error: /workspaces/pio-workspace/main/ZgatewayRF.ino: In function 'void RFtoMQTT()': /workspaces/pio-workspace/main/ZgatewayRF.ino:134:18: error: 'to_string' is not a member of 'std' rawDump += std::to_string(raw[i]);

To Reproduce git checkout v1.7.0 enable + '-DZgatewayRF="RF"' in environments.ini pio run -e rfbridge-direct

Expected behavior A clear and concise description of what you expected to happen.

Screenshots n/a

Environment (please complete the following information):

Additional context Add any other context about the problem here. Processing rfbridge-direct (platform: espressif8266@^2; board: esp8285; framework: arduino)

CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp8285.html
PLATFORM: Espressif 8266 (2.6.3) > Generic ESP8285 Module
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 @ 3.20704.0 (2.7.4) 
 - tool-esptool @ 1.413.0 (4.13) 
 - tool-esptoolpy @ 1.30000.201119 (3.0.0) 
 - toolchain-xtensa @ 2.40802.200502 (4.8.2)

PlatformIO Core, version 6.1.14 xtensa-lx106-elf-g++ (GCC) 4.8.2

If I remove -DZgatewayRF="RF"' project compiles. I tried to reproduce the error in a very small project, this compiles in esp32 bur not in esp8266 -std is set to gnu++11 in both calls

#include <Arduino.h>
#include <string>

void setup() {
  std::to_string(0);
}

void loop() {
}
[env:esp01]
platform = espressif8266
framework = arduino
board = esp01

[env:esp32]
platform = espressif32
framework = arduino
board = esp32dev

pio run -e esp01 fails: 'to_string' is not a member of 'std' pio run -e esp32 works

reimerp commented 3 months ago

if I change in environments.ini

[env:rfbridge-direct]
#platform = espressif8266@^2
with:
platform = ${com.esp8266_platform}

the toolchain updates

CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp8285.html
PLATFORM: Espressif 8266 (4.1.0) > Generic ESP8285 Module
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 @ 3.30101.0 (3.1.1) 
 - tool-esptool @ 1.413.0 (4.13) 
 - tool-esptoolpy @ 1.30000.201119 (3.0.0) 
 - toolchain-xtensa @ 2.100300.220621 (10.3.0)

the code seems to compile, but I got tons on linker errors.

reimerp commented 3 months ago

I checked out a fresh copy, and also development behaves the way. I replaced the rawdump block in main/ZgatewayRF.ino with the one from #a6c0a3b1, which is not relying on std:to_string and build is ok even with on toolchain.

1technophile commented 3 months ago

If you don't need raw dump, I will comment it. If you need it, try to use a char array instead.

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] commented 1 week ago

This issue was closed because it has been inactive for 14 days since being marked as stale.