Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error for ESP32 C3- based boards #1164

Open
jnule1a opened this issue May 30, 2022 · 15 comments
Open

Compile error for ESP32 C3- based boards #1164

jnule1a opened this issue May 30, 2022 · 15 comments

Comments

@jnule1a
Copy link

jnule1a commented May 30, 2022

During compilation for ESP32 C3-based boards (ESP32C3, Adafruit QT Py ESP32-C3, M5Stack Stamp C3) , the following error is displayed:
C:\Users\toto\Documents\Arduino\libraries\ESPAsyncWebServer-master\src\AsyncWebSocket.cpp: In member function 'IPAddress AsyncWebSocketClient::remoteIP()':
C:\Users\toto\Documents\Arduino\libraries\ESPAsyncWebServer-master\src\AsyncWebSocket.cpp:832:28: error: call of overloaded 'IPAddress(unsigned int)' is ambiguous
return IPAddress(0U);
^
In file included from C:\Users\toto\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/Arduino.h:163,
from C:\Users\toto\Documents\Arduino\libraries\ESPAsyncWebServer-master\src\AsyncWebSocket.cpp:21:
C:\Users\toto\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/IPAddress.h:51:5: note: candidate: 'IPAddress::IPAddress(const uint8_t*)'
IPAddress(const uint8_t *address);
^~~~~~~~~
C:\Users\toto\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/IPAddress.h:50:5: note: candidate: 'IPAddress::IPAddress(uint32_t)'
IPAddress(uint32_t address);
^~~~~~~~~
C:\Users\toto\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/IPAddress.h:29:7: note: candidate: 'constexpr IPAddress::IPAddress(const IPAddress&)'
class IPAddress: public Printable
^~~~~~~~~
Multiple libraries were found for "WiFi.h"
Used: C:\Users\toto\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

Test conditions:

  • Arduino IDE 1.8.19
  • ESP32 board manager 2.0.3, M5Stack board manager 2.0.3
  • If board is non C3 e.g. ESP32 Dev module, compilation is ok
  • sketch:
    #include <Arduino.h>
    #include <WiFi.h>
    #include <AsyncTCP.h>
    #include <ESPAsyncWebServer.h>

const char* ssid = "nhatoi";
const char* password = "wifi-1nhatoi";

AsyncWebServer server(80);

void setup(void) {
}

void loop(void) {
}

@HugoML
Copy link

HugoML commented Jun 17, 2022

I got the same error that relates to ESP32-C3 only.

/Users/user/Documents/Arduino/libraries/ESPAsyncWebServer/src/AsyncWebSocket.cpp: In member function 'IPAddress AsyncWebSocketClient::remoteIP()':
/Users/user/Documents/Arduino/libraries/ESPAsyncWebServer/src/AsyncWebSocket.cpp:832:28: error: call of overloaded 'IPAddress(unsigned int)' is ambiguous
return IPAddress(0U);
^
In file included from /Users/user/Library/Arduino15/packages/esp32/hardware/esp32/2.0.3/cores/esp32/Arduino.h:163,
from /Users/user/Documents/Arduino/libraries/ESPAsyncWebServer/src/AsyncWebSocket.cpp:21:
/Users/user/Library/Arduino15/packages/esp32/hardware/esp32/2.0.3/cores/esp32/IPAddress.h:51:5: note: candidate: 'IPAddress::IPAddress(const uint8_t*)'
IPAddress(const uint8_t *address);
^~~~~~~~~
/Users/user/Library/Arduino15/packages/esp32/hardware/esp32/2.0.3/cores/esp32/IPAddress.h:50:5: note: candidate: 'IPAddress::IPAddress(uint32_t)'
IPAddress(uint32_t address);
^~~~~~~~~
/Users/user/Library/Arduino15/packages/esp32/hardware/esp32/2.0.3/cores/esp32/IPAddress.h:29:7: note: candidate: 'constexpr IPAddress::IPAddress(const IPAddress&)'
class IPAddress: public Printable
^~~~~~~~~
Multiple libraries were found for "WiFi.h"
Used: /Users/user/Library/Arduino15/packages/esp32/hardware/esp32/2.0.3/libraries/WiFi
Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi
Using library WiFi at version 2.0.0 in folder: /Users/user/Library/Arduino15/packages/esp32/hardware/esp32/2.0.3/libraries/WiFi

Using library AsyncTCP at version 1.1.1 in folder: /Users/user/Documents/Arduino/libraries/AsyncTCP
Using library ESPAsyncWebServer at version 1.2.3 in folder: /Users/user/Documents/Arduino/libraries/ESPAsyncWebServer
exit status 1
Error compiling for board ESP32C3 Dev Module.

@jnule1a
Copy link
Author

jnule1a commented Jun 17, 2022

At last, I found the following work around: edit libraries\ESPAsyncWebServer-master\src\AsyncWebSocket.cpp to replace “return IPAddress(0U)” by “return IPAddress(0ul)” or “return IPAddress((uin32_t) 0u)”

@HugoML
Copy link

HugoML commented Jun 18, 2022

@jnule1a You rock! I am not using WebSockets and changed the line as you said to return IPAddress ((uint32_t) OU), and the compiler took it. :)
Thanks so much!

@Zimbu98
Copy link

Zimbu98 commented Sep 19, 2022

Typo in jnule1a's very helpful answer: return IPAddress((uin32_t) 0u) should be return IPAddress((uint32_t) 0u)

Notice the little t added

Thanks jnule1a!

@homonto
Copy link

homonto commented Oct 20, 2022

it looks like this library is not maintained anymore ;-( I have the same error but thanks to you guys I solved it ;-)

@RohanJoydhar
Copy link

RohanJoydhar commented Jan 15, 2023

i was working on Esp32-c3 module from speed studio. with esp_dash getting same error. after editing
libraries\ESPAsyncWebServer-master\src\AsyncWebSocket.cpp to replace “return IPAddress(0U)” by “return IPAddress((uint32_t) 0u)” i finnaly got my IP with error, it is a weather station project cunnently trying ant10 sensor module, my code:

#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include <ESPDash.h>
#include <Ticker.h>
#include <Adafruit_AHTX0.h>

Adafruit_AHTX0 aht;
const char* ssid = "ESP32"; // Enter SSID here

Ticker periodicTicker;
AsyncWebServer server(80);
ESPDash dashboard(&server);

Card card1(&dashboard, TEMPERATURE_CARD, "Temperature", "°C");
Card card2(&dashboard, HUMIDITY_CARD, "Humidity", "%");

void updateCards() {
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);
float t = temp.temperature;
float h = humidity.relative_humidity;
card1.update(t);
card2.update(h);
dashboard.sendUpdates();
}

void setup() {
Serial.begin(115200);
aht.begin();
WiFi.softAP(ssid);
server.begin();
delay(100);
Serial.print("IP address: ");
Serial.println(WiFi.softAPIP());
periodicTicker.attach_ms(5000, updateCards);
}

void loop() {}
thnakyou @jnule1a @HugoML

@pyalot
Copy link

pyalot commented Feb 20, 2023

pump

@chezlog
Copy link

chezlog commented Mar 17, 2023

I had to use return IPAddress((uint32_t) 0K)

@adojang
Copy link

adojang commented Mar 28, 2023

At last, I found the following work around: edit libraries\ESPAsyncWebServer-master\src\AsyncWebSocket.cpp to replace “return IPAddress(0U)” by “return IPAddress(0ul)” or “return IPAddress((uin32_t) 0u)”

This fixed it for me.

@FranzKropp
Copy link

Great! The Answer from jnule1a was also the solution for me!

@tahunus
Copy link

tahunus commented Jul 6, 2023

Since that line (832) is meant to return a 0.0.0.0 IP Address if no client is present (I think) besides @jnule1a solution, a IPAddress(0,0,0,0) also works.

@RomanAlexandroff
Copy link

@jnule1a, your solution worked like a charm! Thanks a lot! =)

@bag103
Copy link

bag103 commented Dec 29, 2023

Good afternoon .
I have modified the AsyncWebSocket.ccp library by replacing return IP Address((uin t 32_t) 0u); and continues with the error in any program that refers to <ESPAsyncWebServer.h>
any more ideas??
Thank you so much

@chezlog
Copy link

chezlog commented Dec 29, 2023 via email

@bag103
Copy link

bag103 commented Jan 4, 2024

Good morning.
Thank you for your help in my case the solution was

//return IPAddress(0U); original
return IPAddress((uint32_t)0); -------------------OK-------------------
//return IPAddress((uin t 32_t) 0u);
//return IPAddress(0,0,0,0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests