Fetch Library - Compiler woes

I thought using <fetch.h> would save me quite a bit of time, but the darn thing won't compile. After a few hours of digging into the library files, I'm honestly stumped as to what it is griping about. These look like a valid reference/pointer to me, but clearly something has changed in the last few versions of either ESP32's mDNS or something ...

Anyone know what is up with this IP Address issue?

(Side note: For an IoT platform, it sure is hard to make use of the "I." More standardized libraries to handle http(s) or even just IP address constructs sure seem like they would be a big help.)

c:\Users\z\OneDrive\Documents\Arduino\libraries\Fetch\src\utils\Url\LCBUrl\LCBUrl.cpp: In member function 'IPAddress LCBUrl::getIP(const char*)':
c:\Users\z\OneDrive\Documents\Arduino\libraries\Fetch\src\utils\Url\LCBUrl\LCBUrl.cpp:634:48: error: cannot convert 'ip4_addr*' to 'esp_ip4_addr_t*' {aka 'esp_ip4_addr*'}
         esp_err_t err = mdns_query_a(hn, 2000, &addr);
                                                ^~~~~
In file included from C:\Users\z\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\ESPmDNS\src/ESPmDNS.h:46,
                 from c:\Users\z\OneDrive\Documents\Arduino\libraries\Fetch\src\utils\Url\LCBUrl\LCBUrl.h:41,
                 from c:\Users\z\OneDrive\Documents\Arduino\libraries\Fetch\src\utils\Url\LCBUrl\LCBUrl.cpp:32:
C:\Users\z\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32/include/mdns/include/mdns.h:652:83: note:   initializing argument 3 of 'esp_err_t mdns_query_a(const char*, uint32_t, esp_ip4_addr_t*)'
 esp_err_t mdns_query_a(const char * host_name, uint32_t timeout, esp_ip4_addr_t * addr);
                                                                  ~~~~~~~~~~~~~~~~~^~~~

Looks like your 'addr' variable is the wrong type. The library is expecting an 'esp_ip4_addr_t' and 'addr' seems to be an 'ip4_addr' .

Are you starting with a Fetch library example?

I was responding with the screens of errors that happen when I just change the type to match (the first thing I tried). But then I noticed a line that I didn't try out the first time. So, changing ip4_addr to esp_ip4_addr_t gives me tons of errors that start like this:

c:\Users\z\OneDrive\Documents\Arduino\libraries\Fetch\src\utils\Url\LCBUrl\LCBUrl.cpp:633:16: error: using typedef-name 'esp_ip4_addr_t' after 'struct'
         struct esp_ip4_addr_t addr;
                ^~~~~~~~~~~~~~

However, it also gave me this hint:

c:\Users\z\OneDrive\Documents\Arduino\libraries\Fetch\src\utils\Url\LCBUrl\LCBUrl.cpp:635:48: error: cannot convert 'int*' to 'esp_ip4_addr_t*' {aka 'esp_ip4_addr*'}
         esp_err_t err = mdns_query_a(hn, 2000, &addr);

aka? Hmmmmm ...

Sure enough, changing line 633 of LCBUrl.cpp to read:

struct esp_ip4_addr addr;

does the trick. The whole sketch compiles cleanly, now.

To which I suppose I should say, "Thanks for making me look in the obvious place, again." At first, I was like, "Duh. That's not helpful." But in posting my "here's why," I did happen to find something helpful! :sweat_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.