NodeMCU, Не удалось скомпилировать код из-за нескольких библиотечных ошибок

я получал несколько ошибок и не мог понять, что это такое

   Arduino: 1.8.13 (Windows 10), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"



In file included from E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:29:0:

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.h:27:7: error: redefinition of 'class WiFiUDP'

 class WiFiUDP : public UDP {

       ^

In file included from E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\utility/wifi_drv.h:26:0,

                 from E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:26:

C:\Users\ben\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi\src/WiFiUdp.h:32:7: error: previous definition of 'class WiFiUDP'

 class WiFiUDP : public UDP, public SList<WiFiUDP> {

       ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In constructor 'WiFiUDP::WiFiUDP()':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:35:22: error: class 'WiFiUDP' does not have any field named '_sock'

 WiFiUDP::WiFiUDP() : _sock(NO_SOCKET_AVAIL) {}

                      ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual uint8_t WiFiUDP::begin(uint16_t)':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:45:9: error: '_sock' was not declared in this scope

         _sock = sock;

         ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:46:9: error: '_port' was not declared in this scope

         _port = port;

         ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::available()':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:56:7: error: '_sock' was not declared in this scope

   if (_sock != NO_SOCKET_AVAIL)

       ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual void WiFiUDP::stop()':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:66:8: error: '_sock' was not declared in this scope

    if (_sock == NO_SOCKET_AVAIL)

        ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:69:26: error: '_sock' was not declared in this scope

    ServerDrv::stopClient(_sock);

                          ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::beginPacket(IPAddress, uint16_t)':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:88:7: error: '_sock' was not declared in this scope

   if (_sock == NO_SOCKET_AVAIL)

       ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:90:7: error: '_sock' was not declared in this scope

   if (_sock != NO_SOCKET_AVAIL)

       ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::endPacket()':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:101:32: error: '_sock' was not declared in this scope

  return ServerDrv::sendUdpData(_sock);

                                ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual size_t WiFiUDP::write(const uint8_t*, size_t)':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:111:27: error: '_sock' was not declared in this scope

  ServerDrv::insertDataBuf(_sock, buffer, size);

                           ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::read()':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:125:23: error: '_sock' was not declared in this scope

    ServerDrv::getData(_sock, &b);

                       ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::read(unsigned char*, size_t)':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:137:31: error: '_sock' was not declared in this scope

    if (!ServerDrv::getDataBuf(_sock, buffer, &size))

                               ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::peek()':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:152:22: error: '_sock' was not declared in this scope

   ServerDrv::getData(_sock, &b, 1);

                      ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual IPAddress WiFiUDP::remoteIP()':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:166:25: error: '_sock' was not declared in this scope

  WiFiDrv::getRemoteData(_sock, _remoteIp, _remotePort);

                         ^

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual uint16_t WiFiUDP::remotePort()':

E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi\src\WiFiUdp.cpp:176:25: error: '_sock' was not declared in this scope

  WiFiDrv::getRemoteData(_sock, _remoteIp, _remotePort);

                         ^

Multiple libraries were found for "WiFi.h"

 Used: E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\WiFi

 Not used: E:\Programming\Electronics lab\ARDUINO\sketch\libraries\WiFiNINA

Multiple libraries were found for "HttpClient.h"

 Used: E:\Programming\Electronics lab\ARDUINO\sketch\libraries\HttpClient

 Not used: E:\Programming\Electronics lab\ARDUINO\sketch\libraries\ArduinoHttpClient

 Not used: E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\Bridge

 Not used: E:\Programming\Electronics lab\ARDUINO\arduino-1.8.13-windows\arduino-1.8.13\libraries\HttpClient

 Not used: C:\Users\ben\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\HttpClient

exit status 1

Error compiling for board NodeMCU 0.9 (ESP-12 Module).



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Пожалуйста, помогите мне исправить это

Спасибо и Regardsm Ben

, 👍-1

Обсуждение

Вы должны публиковать КОД, а не только ошибки! Итак, начните с обычного устранения неполадок: ** 1. ** Сократите код до минимума. ** 2. ** Проверьте, работает ли он, и, если работает, переходите к следующему шагу. **3.** Добавляйте функции поэтапно и проверяйте функциональность. ** 4.** Повторяйте шаг 3 до тех пор, пока у вас не будет рабочей базы кода., @Mats Karlsson


1 ответ


0

Удалить #include <WiFi.h>; он не предназначен для использования с вашим NodeMCU.

,