Cannot convert 'ip4_addr_t*' to 'esp_ip4_addr_t*'

I have two machines both with IDE 2.04 and M5STACK board files installed. I have this code:

String resolve_mdns_host(const char * host_name)

{
  //    Serial.printf("Query A: %s.local ", host_name);

  ip4_addr_t addr;
  addr.addr = 0;

  esp_err_t err = mdns_query_a(host_name, 2000,  &addr);

From the same file. One machine is a Mac and the other a Windows 10 Machine. The Mac compiles with this error
cannot convert 'ip4_addr_t*' {aka 'ip4_addr*'} to 'esp_ip4_addr_t*' {aka 'esp_ip4_addr*'}
The Windows machine compiles fine. I had changed the declaration "ip4_addr_t addr;" from "esp_ip4_addr_t" because this code which had been working for months started to complain that esp_ip4_addr_t was not defined in this scope. Both M5STACK board definitions are Version 2.06-1.0.

What is wrong here?

Thanks
Kurt

esp_ip4_addr_t is defined in esp_netif_ip_addr.h. You get that file if you #include "WiFi.h"

Thanks. It is included. IDK how how times I compiled this on the Mac, and ran it on the M5STACK, in the past with no issue. Then it it starts complaining and now it won't compile.

I don't really know what an "M5STACK" is. Which exact board do you have selected in the IDE? I selected "M5Stack-CORE-ESP32" and esp_ip4_addr_t is defined when I compile on both Eclipse/Sloeber and IDE 1.8.19. Both are using ESP32 Core 2.0.6.

M5STACK CORE is a ESP32. So I noticed that one machine has WiFi 1.0 and the Mac has 2.0. How does one update the WiFi library? The ESP32 Core is the same version 2.06 on both.

I didn't see answer.

Sorry the Board is M5stack-Core-ESP32.

Do you know how to update the WiFi library?

Nope. I just figured it was tied to the Board Package (2.06). Don't know why there'd be different versions of the same library in two installations of the same package version. Maybe an installation problem? Did you check esp_netif_ip_addr.h in both installations? Did both include the definition of esp_ip4_addr_t?

On the PC which is failing I find in a
~\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.6\tools\sdk\esp32\include\esp_netif\include\esp_netif_ip_addr.h

/**
 * @brief IP address
 *
 */
typedef struct _ip_addr {
    union {
        esp_ip6_addr_t ip6; /*!< IPv6 address type */
        esp_ip4_addr_t ip4; /*!< IPv4 address type */
    } u_addr;               /*!< IP address union */
    uint8_t type;           /*!< ipaddress type */
} esp_ip_addr_t;

I am searching my Mac but I can't find where these files are.

Thanks
Kurt

Just to add the code that fails looks like this:

#ifndef CONNECTWIFI
#define CONNECTWIFI
#include <WiFi.h>
#include <WiFiClient.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include "ArduinoTimer.h"                                                            // https://www.megunolink.com/documentation/arduino-libraries/arduino-timer/
ArduinoTimer WiFiTimer;

esp_ip4_addr_t addr;

I found the files on the Mac in ~/Library/Arduino15/packages/m5stack/hardware/esp32/2.0.6/tools/sdk/esp32s3/include/esp_netif/include

and the declaration is the same. On the Mac I get this compile message:

Alternatives for WiFi.h: [WiFi@2.0.0]
ResolveLibrary(WiFi.h)
-> candidates: [WiFi@2.0.0]

On windows I get:
"C:\Users\Kurt\AppData\Local\Temp\arduino\sketches\3D0D4EE545CC1EEA0D5256F4BE06168F\sketch\ROR_ESPDUINO_L350_M5Stack.ino.cpp" -o nul
Alternatives for WiFi.h: [WiFi@1.0]
ResolveLibrary(WiFi.h)
-> candidates: [WiFi@1.0]

I feel I am getting smarter.

On the Mac there is one board listed as M5stack-Core-ESP32

On Windows there are two listed

M5stack-Core-ESP32-M5stack
and M5stack-Core-ESP32-ESP32

In both cased the -M5stack and the -ESP32 are shown as gray text and when you select the board it only shows M5stack-Core-ESP32 as the board but the -M5stack version selected WiFi 2.0.0 and the ESP version selects 1.0.0

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