Skip to content

error: call of overloaded Wire.begin(int&, int, int)' is ambiguous #85

Closed
@platypii

Description

@platypii

The code in BMP180.cpp does not compile after upstream arduino-esp32 library was updated.

.pio/libdeps/heltec_wifi_lora_32_V2/Heltec ESP32 Dev-Boards/src/BMP180.cpp:13:29: error: call of overloaded 'begin(int&, int, int)' is ambiguous
   Wire.begin(sda, 12, 100000);
                             ^
In file included from .pio/libdeps/heltec_wifi_lora_32_V2/Heltec ESP32 Dev-Boards/src/BMP180.h:5,
                 from .pio/libdeps/heltec_wifi_lora_32_V2/Heltec ESP32 Dev-Boards/src/BMP180.cpp:1:
.platformio/packages/framework-arduinoespressif32/libraries/Wire/src/Wire.h:79:10: note: candidate: 'bool TwoWire::begin(int, int, uint32_t)'
     bool begin(int sda=-1, int scl=-1, uint32_t frequency=0); // returns true, if successful init of i2c bus
          ^~~~~
.platformio/packages/framework-arduinoespressif32/libraries/Wire/src/Wire.h:80:10: note: candidate: 'bool TwoWire::begin(uint8_t, int, int, uint32_t)'
     bool begin(uint8_t slaveAddr, int sda=-1, int scl=-1, uint32_t frequency=0);
          ^~~~~

I'm trying to use this library via platformio. My code worked, and was unchanged for more than 1 year. I just went back to the project, updated library versions, and now I'm getting a compile error from this library.

Specifically, in BMP180.cpp there is a call to Wire.begin.

This used to be fine. But then the underlying framework-arduinoespressif32 library was updated to add an overloaded Wire.begin function, which makes the call here ambiguous.

     bool begin(int sda=-1, int scl=-1, uint32_t frequency=0); // returns true, if successful init of i2c bus
+    bool begin(uint8_t slaveAddr, int sda=-1, int scl=-1, uint32_t frequency=0);

I tried some changes to the BMP180.cpp in this repo to see if I could fix it, but I couldn't figure out how to make the compiler know which Wire.begin function to use. I also left a comment on the arduino-esp32 repo to see if they have any suggestions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions