Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

espconn.h - conflicting declaration of dns_found_callback

Open vgahlaut opened this issue 1 year ago • 1 comments

Basic Infos

  • [x] This issue complies with the issue POLICY doc.
  • [x] I have read the documentation at readthedocs and the issue is not addressed there.
  • [x] I have tested that the issue is present in current master branch (aka latest git).
  • [x] I have searched the issue tracker for a similar issue.
  • [ ] If there is a stack dump, I have decoded it.
  • [x] I have filled out all fields below.

Platform

  • Hardware: [ESP-12]
  • Core Version: [3.1.2]
  • Development Env: [Arduino IDE|
  • Operating System: [Windows|]

Settings in IDE

  • Module: [Generic ESP8266 Module]
  • Flash Mode: [dio]
  • Flash Size: [4MB/1MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [ck]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

Detailed problem description goes here.

If we include sdk espconn.h in our code. It gets conflicting type of dns_found_callback during compilation. Compilation error and sketch are provided to reproduce problem.

Request you to please suggest some workaround to get over this issue.

MCVE Sketch


extern "C"{
    // Platform Includes
    #include <espconn.h>
}

#include <ESP8266WiFi.h>

// the setup function runs once when you press reset or power the board
void setup() {
  Serial.begin(115200);
  WiFi.begin((char*)"testssid", (char*)"testpassword");
}
void loop() {
  
}

Debug Messages

In file included from C:\Users\vipin\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:29,
                 from C:\Users\vipin\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:28,
                 from C:\Users\vipin\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34,
                 from C:\Users\vipin\Desktop\dns_found_cb_reproducer\dns_found_cb_reproducer.ino:16:
C:\Users\vipin\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2/tools/sdk/lwip2/include/lwip/dns.h:103:16: error: conflicting declaration 'typedef void (* dns_found_callback)(const char*, const ip_addr_t*, void*)'
  103 | typedef void (*dns_found_callback)(const char *name, const ip_addr_t *ipaddr, void *callback_arg);
      |                ^~~~~~~~~~~~~~~~~~
In file included from C:\Users\vipin\Desktop\dns_found_cb_reproducer\dns_found_cb_reproducer.ino:13:
C:\Users\vipin\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2/tools/sdk/include/espconn.h:447:16: note: previous declaration as 'typedef void (* dns_found_callback)(const char*, ip4_addr_t*, void*)'
  447 | typedef void (*dns_found_callback)(const char *name, ipv4_addr_t *ipaddr, void *callback_arg);

vgahlaut avatar Dec 19 '23 16:12 vgahlaut