Cannot find WebServer.h of ESP32 Core

I want to include the WebServer.h library from the ESP32 Core Installation.
I already added the URL down below to the Boardmanager and successfully used for example the WiFi.h library.

However if I reference the WebServer.h it always raises an error saying:

Arduino: 1.8.19 (Windows 10), Board: "NodeMCU-32S, 80MHz, 921600"


Multiple libraries were found for "WiFi.h"

CarMatrix:6:10: fatal error: WebServer.h: No such file or directory

 Used: C:\Users\hoebe\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.2\libraries\WiFi

 #include <Webserver.h>

 Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

          ^~~~~~~~~~~~~

compilation terminated.

exit status 1

Webserver.h: No such file or directory

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

I searched for the path and the file is present in:
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.2\libraries\WebServer\src

URL used for ESP32 Core:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Here is my Code:

//Include Libraries and Files
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include <WiFi.h>
#include <WebServer.h>
#include <ArduinoJson.h>

#include "index.h"

////Define Globals
#define PIN 4

//Init the NeoPixel Matrix
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, PIN, NEO_MATRIX_BOTTOM + NEO_MATRIX_RIGHT + NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG, NEO_GRB + NEO_KHZ800);
//Defined Colors
const uint16_t colors[] = {matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(255, 255, 0), matrix.Color(0, 0, 255), matrix.Color(255, 0, 255), matrix.Color(0, 255, 255), matrix.Color(255, 255, 255)};





//DisplayedText
String displayedText = "This is a very long text";

//Wifi Credetials
char *SSID = "Autodisplay";
char *PASSWORD = "2022#display";

//WebServer and API-Response
WebServer server(80);
String header;

// JSON data buffer for sending information to Webclient
StaticJsonDocument<250> jsonDocument;
char buffer[250];




void setup() {
  //Start Consol Output
  Serial.begin(115200);
  Serial.println();

  //Init the NeoPixel Matrix
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(5);
  matrix.setTextColor(colors[0]);

  //Setup Accesspoint & WebServer
  setupAccessPoint();
  setupWebServer();
}




int x    = matrix.width();
int pass = 0;
int scrollLength = (displayedText.length() * 5 + 25) * (-1);



void loop() {

  //shift current Text
  shiftText();
  matrix.show();

  //listen for web requests
  server.handleClient();

  delay(30);
}



//Shift Text on NeoPixel Matrix to the left
void shiftText() {
  //Text scrolling by
  matrix.fillScreen(0);    //Turn off all the LEDs
  matrix.setCursor(x, 0);
  matrix.print(displayedText);
  if ( --x < scrollLength ) {
    x = matrix.width();
    if (++pass >= 8) pass = 0;
    matrix.setTextColor(colors[pass]);
  }
}

//Init the AccessPoint of the ESP32 WiFi Module
void setupAccessPoint() {
  Serial.println("Setting up AccessPoint");
  WiFi.softAP(SSID, PASSWORD);
  IPAddress ap_ip = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(ap_ip);
}


//Init the Webserver and the routing
void setupWebServer() {
  Serial.println("Setup Webserver routing");

  //Setup for GET Requests
  server.on("/get/settings", sendSettings);
  server.on("/", handleRoot);
  //Setup for POST Requests
  server.on("/post/settings", HTTP_POST, handleSettingsPost);

  //Start Websever
  Serial.println("Start Webserver on Port 80");
  server.begin();
}


//Create JSON-Data in the jsonDocument
void create_json(char *key, char *value) {
  jsonDocument.clear();
  jsonDocument[key] = value;
  serializeJson(jsonDocument, buffer);
}


//Add JSON-Data to the jsonDocument
void add_json_object(char *key, char *value) {
  JsonObject obj = jsonDocument.createNestedObject();
  obj[key] = value;
}

//send Settings to connected Client in JSON-Format
void sendSettings() {
  Serial.println("Sending Settings to Client");
  create_json("testKey", colors[0]);
  server.send(200, "application/json", buffer);
  //Send Website back
  handleRoot();
}


//Handle Settings Post from Client
void handleSettingsPost() {
  if (server.hasArg("plain") == false) {
    //Client hasten Send any data
    Serial.println("No JSON Data sent as Settings");
  }
  String body = server.arg("plain");
  deserializeJson(jsonDocument, body);

  displayedText = jsonDocument["displayedText"];

  Serial.print("Text is changed to: ");
  Serial.println(displayedText);
}

void handleRoot() {
  Serial.println("Response with Website");
  server.send(200, "text/html", MAIN_page);
}

Hi @zipfeglatscher. I'm going to ask you to post some additional information that might help us to identify the problem.

Please do this:

  1. When you encounter an error, you'll see a button on the right side of the orange bar in the Arduino IDE: Copy error messages. Click that button.
  2. Open a forum reply here by clicking the Reply button.
  3. Click the </> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block
  4. Press Ctrl+V.
    This will paste the compilation output into the code block.
  5. Move the cursor outside of the code block markup before you add any additional text to your reply.
  6. Click the Reply button to post the output.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

Thanks for using code tags in your first post.

I played around with the replies thats why i deleted one post and now it says my post is to similar to the previos so i'm writting this line

Here is the complete error message:

Arduino: 1.8.19 (Windows 10), Board: "NodeMCU-32S, 80MHz, 921600"





















Multiple libraries were found for "WiFi.h"

CarMatrix:6:10: fatal error: Webserver.h: No such file or directory

 Used: C:\Users\hoebe\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.2\libraries\WiFi

 #include <Webserver.h>

 Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

          ^~~~~~~~~~~~~

compilation terminated.

exit status 1

Webserver.h: No such file or directory



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

It says multiple libs for "WiFi.h", i have also installed the boardsmanager for the esp8266 if that is the problem

Or ?

Nice try, but bold text does not work in code tags

I tried it with both lowercase and uppercase "s". But in the inital post i got the wrong errormessage to my code, sorry for that.

But i restarted my Notebook today and opend Arduino IDE again and now it recognizes the library.

I had a file named WebServer.h containing my functions for wifi and webserver in my sketch folder that i importet with #include 'WebServer.h'. But i deleted it before the error came up, maybe that confused the IDE.

2 posts were split to a new topic: WebServer.h: No such file or directory

Hey, which library do I install for that. There's multiple ones with similar names and I don't wanna download the wrong one

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