Ошибка в коде arduino

Код на отправку POST запросов на сервер через esp8266

Код:
#define SERVER_IP "192.168.1.42"

#ifndef STASSID
#define STASSID "your-ssid"
#define STAPSK "your-password"
#endif

void setup() {

Serial.begin(115200);

Serial.println();
Serial.println();
Serial.println();

WiFi.begin(STASSID, STAPSK);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected! IP address: ");
Serial.println(WiFi.localIP());
}

void loop() {
// wait for WiFi connection
if ((WiFi.status() == WL_CONNECTED)) {

WiFiClient client;
HTTPClient http;

Serial.print("[HTTP] begin...\n");
// configure traged server and url
http.begin(client, "http://" SERVER_IP "/postplain/");  // HTTP
http.addHeader("Content-Type", "application/json");

Serial.print("[HTTP] POST...\n");
// start connection and send HTTP header and body
int httpCode = http.POST("{\"hello\":\"world\"}");

// httpCode will be negative on error
if (httpCode > 0) {
  // HTTP header has been send and Server response header has been handled
  Serial.printf("[HTTP] POST... code: %d\n", httpCode);

  // file found at server
  if (httpCode == HTTP_CODE_OK) {
    const String& payload = http.getString();
    Serial.println("received payload:\n<<");
    Serial.println(payload);
    Serial.println(">>");
  }
} else {
  Serial.printf("[HTTP] POST... failed, error: %s\n", http.errorToString(httpCode).c_str());
}

http.end();

}

delay(10000);
}

Ошибка: c:\Users\dimam\Documents\Arduino\libraries\ESP8266WiFi\src\ESP8266WiFiAP.cpp:29:10: fatal error: LwipDhcpServer-NonOS.h: No such file or directory
29 | #include <LwipDhcpServer-NonOS.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

please post in English in the general forum and do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation for your ask).

Code for sending POST requests to the server via esp8266

The code:
WiFiClient client;
HTTPClient http;

Serial.print("[HTTP] begin...\n");
// configure traged server and url
http.begin(client, "http://" SERVER_IP "/postplain/"); // HTTP
http.addHeader("Content-Type", "application/json");

Serial.print("[HTTP] POST...\n");
// start connection and send HTTP header and body
int httpCode = http.POST("{"hello":"world"}");

// httpCode will be negative on error
if (httpCode > 0) {
// HTTP header has been send and Server response header has been handled
Serial.printf("[HTTP] POST... code: %d\n", httpCode);

// file found at server
if (httpCode == HTTP_CODE_OK) {
const String& payload = http.getString();
Serial.println("received payload:\n<<");
Serial.println(payload);
Serial.println(">>");
}
} else {
Serial.printf("[HTTP] POST... failed, error: %s\n", http.errorToString(httpCode).c_str());
}

http.end();

error: c:\Users\dimam\Documents\Arduino\libraries\ESP8266WiFi\src\ESP8266WiFiAP.cpp:29:10: fatal error: LwipDhcpServer-NonOS.h: No such file or directory
29 | #include <LwipDhcpServer-NonOS.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

no code tags... bye.

Вам не хватает "библиотеки".

I do getting same error while compiling my nodeMCU:
"ESP8266WiFiAP.cpp:29:10: fatal error: LwipDhcpServer-NonOS.h: No such file or directory"

no compiling errors showing while testing example code "Blink"
please anybody help me to overcome this problem??

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