[SOLVED] Where has WebServer.h gone?

I 'borrowed' a sketch from robohubs instructables page, some of which I have included here :

#include <Arduino_BuiltIn.h>
//more details on robohub instructables page//
#include <WiFi.h>
#include <WiFiClient.h> 
#include <WebServer.h>
String command;             //String to store app command state.
int speedCar = 800;         // 400 - 1023.
int speed_Coeff = 3;
const char* ssid = "NodeMCU Car";
WebServer server(80);
void setup() {
  Serial.begin(115200);
// Connecting WiFi
  WiFi.mode(WIFI_AP);
  WiFi.softAP(ssid);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
 // Starting WEB-server 
     server.on ( "/", HTTP_handleRoot );
     server.onNotFound ( HTTP_handleRoot );
     server.begin();    
}
void loop() {
    server.handleClient();
      command = server.arg("State");
      if (command == "F") goAhead();
      else if (command == "B") goBack();
      else if (command == "S") stopRobot();
}
void HTTP_handleRoot(void) {
if( server.hasArg("State") ){
       Serial.println(server.arg("State"));
  }
  server.send ( 200, "text/html", "" );
  delay(1);
}

that runs a robot from wifi for a 8266. I altered it to run an ESP32 mainly from

//#include <ESP8266WiFi.h>
//#include <WiFiClient.h>
//#include <ESP8266WebServer.h>

to

#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>

and it ran my robot from the wifi app NodeMCU.
last night I opened the sketch and did some more altering only to find when I compiled it I got

J:\My Drive\mecanum robot car\file_for_the_forum\file_for_the_forum.ino:7:10: fatal error: WebServer.h: No such file or directory
    7 | #include <WebServer.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: WebServer.h: No such file or directory

I can't find the file WebServer.h in my library, I am sure I haven't deleted any libraries or altered the location of any, (it seems to still accept WiFi.h and WiFiClient.h as if it sees them?)
I have tried to add various libraries for webserver from the library list but none of them include WebServer.h
Why has it worked on previous evenings and not now?
Would someone mind trying to explain what I am doing wrong and the possible location of a library that holds the file I need?
Thanks.

it's part of the ESP32 Arduino core..
Should be valid if you have a ESP32 board selected when verifying..

good luck.. ~q

1 Like

Thank you for such a quick reply qubits-us.
My reply has taken so long because compiling takes about 5 minutes each time?

The board in the box at the top of the IDE was adafruit feather HUZZAH which is the board I thought I have.
Just for the heck of it I altered it to the Adafruit ESP32 feather, (there is no adafruit ESP32 feather HUZZAH only a 8266 version but mine clearly says adafruit ESP32 feather HUZZAH on it.
I wonder if I had ESP32 feather in before I looked at a sketch from a while ago and the IDE locked onto the HUZZAH board and put that in every time I opened a new sketch?
I now have it on Adafruit ESP32 feather and it compiles and loads into the board.
Again thanks for the help I was pulling my hair out last night wondering what I had done wrong.

1 Like

You're welcome..
never seen one of them boards, so not sure..
could have also been corrupt core, so I'm glad you get it going..

have fun.. ~q

4 posts were split to a new topic: Compilation for UNO R4 WiFi fails: "WebServer.h: No such file or directory"

A post was split to a new topic: Webserver.h raises error when compiling for ESP32-WROOM

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