Skip to content

Discussion: regarding Arduino IDE example code using arduino-esp32 v3 #96

@GotRobbd

Description

@GotRobbd

I have noticed that people may stumble upon using the library properly when using the latest version of arduino-esp32 (currently at 3.0.3). This has been caused by an external library named ArduinoHttpClient, which fails to build.

This is due to the GCC compiler's byte class and the Arduino's byte typedef clashing with each other, causing ambiguity. This is not an issue when using arduino-esp32 v2.0.17 and lower, however. This problem is arising now because arduino-esp32 v3 is using GCC 12.2.0, whilst arduino-esp32 v2 is using is using GCC 8.4.0. This is important because the former is using the C++17 standard or higher, which introduce the byte class in the language. The latter is still using C++11, which does not have such class.

The problem not only affects ArduinoHttpClient, but any other Arduino library using the byte typedef, including TinyGsm.

The good news is that there is an easy workaround. When opening one of the examples in ArduinoIDE from this library, look for #include <ArduinoHttpClient.h> and put it as the first include. This should fix the issue and the code should compile just fine. If it still does not work, try and put it in between the other includes until the code compiles.

Original https_wifi example code in ArduinoIDE, fails to compile due to "byte" definition ambiguity:
image

Modified https_wifi example code in ArduinoIDE, compiles fine:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions