arduino-libraries / ArduinoMDNS

mDNS Library for Arduino
40 stars 13 forks source link

\libraries\WiFi101\src/socket/include/socket.h:1839:15: error: conflicting declaration of C function 'sint8 close(SOCKET)' #30

Closed huster-songtao closed 10 months ago

huster-songtao commented 10 months ago
In file included from d:\Arduino\Sketchbook\libraries\WiFi101\src/WiFiClient.h:28,
                 from d:\Arduino\Sketchbook\libraries\WiFi101\src/WiFi101.h:35,
                 from C:\Users\tao\AppData\Local\Temp\.arduinoIDE-unsaved2024025-8816-1pfxd5m.1slaf\WiFiResolvingHostNames\WiFiResolvingHostNames.ino:25:
d:\Arduino\Sketchbook\libraries\WiFi101\src/socket/include/socket.h:1839:15: error: conflicting declaration of C function 'sint8 close(SOCKET)'
 NMI_API sint8 close(SOCKET sock);
               ^~~~~
In file included from C:\Users\tao\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14/tools/sdk/esp32c3/include/newlib/platform_include/sys/unistd.h:23,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\sys-include\unistd.h:4,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\sys-include\pthread.h:25,
                 from C:\Users\tao\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14/tools/sdk/esp32c3/include/newlib/platform_include/pthread.h:21,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\riscv32-esp-elf\rv32imc\ilp32\no-rtti\bits\gthr-default.h:48,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\riscv32-esp-elf\rv32imc\ilp32\no-rtti\bits\gthr.h:151,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\ext\atomicity.h:35,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\bits\basic_string.h:39,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\string:52,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\stdexcept:39,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\array:39,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\tuple:39,
                 from c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\functional:54,
                 from C:\Users\tao\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/HardwareSerial.h:49,
                 from C:\Users\tao\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:184,
                 from C:\Users\tao\AppData\Local\Temp\arduino\sketches\63ADCEAE1835CF6FB6AEF0D323A2C879\sketch\WiFiResolvingHostNames.ino.cpp:1:
c:\users\tao\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\sys-include\sys\unistd.h:30:9: note: previous declaration 'int close(int)'
 int     close (int __fildes);
         ^~~~~

exit status 1

Compilation error: exit status 1
per1234 commented 10 months ago

Hi @huster-songtao. Thanks for your interest in this open source project.

The error you shared is related to the "WiFi101" library, which is used with the hardware such as the MKR 1000 WiFi and WiFi 101 Shield with an Atmel WINC1500 Wi-Fi radio module. I'm certain you are not using a WINC1500 with your ESP32 board since the ESP32 has native Wi-Fi capability.

It seems you are compiling the library's "WiFiResolvingHostNames example sketch. That example is configured for use with the WINC1500 and would require some adjustment to be used with other hardware.

This issue tracker is only to be used to report bugs or feature requests specific to the project. This issue is more about improper use of the library so it is more appropriate for the Arduino Forum. I'm sure we will be able to help you out over there:

https://forum.arduino.cc/