Error: reference to 'byte' is ambiguous

Hi,

I’ve started learning PlatformIO with ESP32 core. I’m trying to migrate some of my Arduino sketches into Platformio, but unfortunately I’m still getting the error:

In file included from src/main.cpp:6:
.pio/libdeps/esp32s3_120_16_8-qio_opi/WiFiManager/WiFiManager.h:536:11: error: reference to 'byte' is ambiguous
  536 |     const byte    DNS_PORT                = 53;
      |           ^~~~
In file included from C:/Users/Czarek/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/memory_resource.h:38,
                 from C:/Users/Czarek/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/unordered_map:50,
                 from C:/Users/Czarek/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/functional:63,
                 from C:/Users/Czarek/.platformio/packages/framework-arduinoespressif32/cores/esp32/HardwareSerial.h:49,
                 from C:/Users/Czarek/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:203,
                 from src/main.cpp:1:
C:/Users/Czarek/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/cstddef:69:14: note: candidates are: 'enum class std::byte'
   69 |   enum class byte : unsigned char {};
      |              ^~~~
C:/Users/Czarek/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:152:17: note:                 'typedef uint8_t byte'
  152 | typedef uint8_t byte;
      |                 ^~~~
*** [.pio\build\esp32s3_120_16_8-qio_opi\src\main.cpp.o] Error 1

The code is easy like that:

#include <Arduino.h>

#include "Audio.h" // (https://github.com/schreibfaul1/ESP32-audioI2S)
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "WiFiManager.h"
//#include <AsyncTCP.h> // (https://github.com/ESP32Async/AsyncTCP)
//#include <ESPAsyncWebServer.h> // (https://github.com/ESP32Async/ESPAsyncWebServer)
#include <LittleFS.h>
#include <Preferences.h>
#include <Rotary.h>  // by Ben Buxton (http://www.buxtronix.net/2011/10/rotary-encoders-done-properly.html; https://github.com/buxtronix/arduino/tree/master/libraries/Rotary)
#include "Audio_Symbole.h"


void setup() {
  
}

void loop() {
 
}

The project structure looks like:

Could you please enlight what I’m doing wrong.

Thanks!

Please also show the content of your platformio.ini so we know exactly which libraries, versions etc are used in your project.

Hi.

; PlatformIO Project Configuration File

;

; Build options: build flags, source filter

; Upload options: custom upload port, speed and extra flags

; Library options: dependencies, extra library storages

; Advanced options: extra scripting

;

; Please visit documentation for the other options and examples

; https://docs.platformio.org/page/projectconf.html

[env:esp32s3_120_16_8-qio_opi]

platform = espressif32

board = esp32s3_120_16_8-qio_opi

framework = arduino

lib_deps =

adafruit/Adafruit GFX Library@^1.12.0

adafruit/Adafruit ILI9341@^1.6.1

tzapu/WiFiManager@^2.0.17

This is a custom board which might have some settings we don’t know.
Please also share the board manifest for this board (esp32s3_120_16_8-qio_opi.json)

The lib_deps sections in your platformio.ini must indented! Please make sure that this is just a copy and paste error and your platformio.ini looks like this:

[env:esp32s3_120_16_8-qio_opi]
platform = espressif32
board = esp32s3_120_16_8-qio_opi
framework = arduino
lib_deps =
  adafruit/Adafruit GFX Library@^1.12.0
  adafruit/Adafruit ILI9341@^1.6.1
  tzapu/WiFiManager@^2.0.17

Here is esp32s3_120_16_8-qio_opi.json

{
  "build": {
    "arduino": {
      "memory_type": "qio_opi",
      "partitions": "default_16MB.csv"
    },
    "core": "esp32",
    "f_cpu": "240000000L",
    "f_flash": "80000000L",
    "f_boot": "120000000L",
    "boot": "qio",
    "flash_mode": "qio",
    "extra_flags": [
      "-DBOARD_HAS_PSRAM",
      "-DARDUINO_USB_MODE=1",
      "-DARDUINO_USB_CDC_ON_BOOT=1",
      "-DARDUINO_RUNNING_CORE=1",
      "-DARDUINO_EVENT_RUNNING_CORE=1"
    ],
    "hwids": [
      [
        "0x303A",
        "0x1001"
      ]
    ],
    "mcu": "esp32s3",
    "variant": "esp32s3"
  },
  "connectivity": [
    "bluetooth",
    "wifi"
  ],
  "debug": {
    "openocd_target": "esp32s3.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "ESP32-S3 16MB QIO, 8MB OPI PSRAM",
  "upload": {
    "flash_size": "16MB",
    "maximum_ram_size": 327680,
    "maximum_size": 16777216,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf",
  "vendor": "espressif"
}

The platformio.ini:

The error comes from the outdated / not updated WiFiManager library.

Change your lib_deps to:

lib_deps =
  adafruit/Adafruit GFX Library@^1.12.0
  adafruit/Adafruit ILI9341@^1.6.1
  https://github.com/tzapu/WiFiManager
  https://github.com/schreibfaul1/ESP32-audioI2S

Works! Thx. Strange, I used PIO library manager to instal those libraries, aren’t they up-to-date?

The author of the library did not create a new release yet.

You’re now using the version directly from github which contains a fix. But it is still 2.0.17.

Please open an issue here: https://github.com/tzapu/WiFiManager/issues

1 Like

4 posts were split to a new topic: How to use framwork=arduino, espidf?