user47558: I'm trying to do an async webserver with access point using an ESP32.
It's a little bit of a mix between This tutorial for AP and async and this tutorial since it's also with an async webserver and it uses inputs which I desperately need.
The part I don't understand is I included all the necessary libraries and I still got this error. If I copy-paste the code in one block everything is fine. It was never necessary to declare HTTP_GET since it should be a variable from a library.
So what's wrong?
These are my errors:
    In file included from C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:467:0,
                     from C:\..\AppData\Local\Temp\arduino_build_497972\sketch\webserver.h:5,
                     from C:\..\Async Webserver ESP32\main\main.ino:3:
    C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h: In constructor 'AsyncCallbackWebHandler::AsyncCallbackWebHandler()':
    C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h:76:49: error: 'HTTP_ANY' was not declared in this scope
         AsyncCallbackWebHandler() : _uri(), _method(HTTP_ANY), _onRequest(NULL), _onUpload(NULL), _onBody(NULL), _isRegex(false) {}
                                                     ^
    In file included from C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:467:0,
                     from C:\..\AppData\Local\Temp\arduino_build_497972\sketch\webserver.h:5,
                     from C:\..\AppData\Local\Temp\arduino_build_497972\sketch\webserver.cpp:1:
    C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h: In constructor 'AsyncCallbackWebHandler::AsyncCallbackWebHandler()':
    C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h:76:49: error: 'HTTP_ANY' was not declared in this scope
         AsyncCallbackWebHandler() : _uri(), _method(HTTP_ANY), _onRequest(NULL), _onUpload(NULL), _onBody(NULL), _isRegex(false) {}
                                                     ^
    C:\Users\Valentin\AppData\Local\Temp\arduino_build_497972\sketch\webserver.cpp: In function 'void setup_server(AsyncWebServer)':
    webserver.cpp:6:18: error: 'HTTP_GET' was not declared in this scope
       server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
                      ^
    Multiple libraries were found for "WiFi.h"
     Used: C:\..\Arduino15\packages\firebeetle32\hardware\esp32\0.1.1\libraries\WiFi
     Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
    Using library ESPAsyncWebServer-master at version 1.2.3 in folder: C:\..\Arduino\libraries\ESPAsyncWebServer-master 
    Using library FS at version 1.0 in folder: C:\..\Arduino15\packages\firebeetle32\hardware\esp32\0.1.1\libraries\FS 
    Using library WiFi at version 1.0 in folder: C:\..\Arduino15\packages\firebeetle32\hardware\esp32\0.1.1\libraries\WiFi 
    Using library AsyncTCP-master at version 1.1.1 in folder: C:\..\Arduino\libraries\AsyncTCP-master 
    exit status 1
    'HTTP_GET' was not declared in this scope

I already tried to use the standard Arduino WiFi library which resulted just in more errors so I switched it back.
I split up the code into three pieces for better visibility.
main.ino
#include <Arduino.h>
#include "webserver.h"
    
// REPLACE WITH YOUR NETWORK CREDENTIALS
const char* ssid = "blabla";
const char* password = "blabla";
    
void setup() {
  Serial.begin(115200);
  WiFi.softAP(ssid, password);
  IP = WiFi.softAPIP();
    
  Serial.println();
  Serial.print("IP Address: ");
  Serial.println(IP);
      
  setup_server(server);
}

void loop() {}

webserver.cpp
#include "webserver.h"
    
void setup_server(AsyncWebServer server) {
  // Send web page with input fields to client
  server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send_P(200, "text/html", index_html);
  });
    
  // Send a GET request to <ESP_IP>/get?input1=<inputMessage>
  server.on("/get", HTTP_GET, [] (AsyncWebServerRequest * request) {
    // GET input1 value on <ESP_IP>/get?input1=<inputMessage>
    if (request->hasParam(PARAM_INPUT_1)) {
      inputMessage = request->getParam(PARAM_INPUT_1)->value();
      inputParam = PARAM_INPUT_1;
    }
    // GET input2 value on <ESP_IP>/get?input2=<inputMessage>
    else if (request->hasParam(PARAM_INPUT_2)) {
      inputMessage = request->getParam(PARAM_INPUT_2)->value();
      inputParam = PARAM_INPUT_2;
    }
    // GET input3 value on <ESP_IP>/get?input3=<inputMessage>
    else if (request->hasParam(PARAM_INPUT_3)) {
      inputMessage = request->getParam(PARAM_INPUT_3)->value();
      inputParam = PARAM_INPUT_3;
    }
    else {
      inputMessage = "No message sent";
      inputParam = "none";
    }
    Serial.println(inputMessage);
    request->send(200, "text/html", "HTTP GET request sent to your ESP on input field ("
      + inputParam + ") with value: " + inputMessage +
      "<br><a href=\"/\">Return to Home Page</a>");
    });
    server.onNotFound(notFound);
    server.begin();
  }
    
void notFound(AsyncWebServerRequest *request) {
  request->send(404, "text/plain", "Not found");
}

webserver.h
#ifndef WEBSERVER_H
#define WEBSERVER_H
    
#include "Arduino.h"
#include "ESPAsyncWebServer.h"
#include "AsyncTCP.h"
#include <WiFi.h>
    
const char* PARAM_INPUT_1 = "input1";
const char* PARAM_INPUT_2 = "input2";
const char* PARAM_INPUT_3 = "input3";
  
AsyncWebServer server(80);
    
String music_state;
IPAddress IP;
    
String inputMessage;
String inputParam;
    
// HTML web page to handle 3 input fields (input1, input2, input3)
const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html><head>
  <title>ESP Input Form</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  </head><body>
  <form action="/get">
    input1: <input type="text" name="input1">
    <input type="submit" value="Submit">
  </form><br>
  <form action="/get">
    input2: <input type="text" name="input2">
    <input type="submit" value="Submit">
  </form><br>
  <form action="/get">
    input3: <input type="text" name="input3">
    <input type="submit" value="Submit">
  </form>
</body></html>)rawliteral";

void setup_server(AsyncWebServer server);
    
void notFound(AsyncWebServerRequest *request);
    
#endif

Thanks for the input, I will check back tomorrow and answer all questions and test every suggestion.

user70020: Macro Conflict
You have two basic problems here.  The more significant one is that your use of SERVER_H in your include guard:
#ifndef WEBSERVER_H
#define WEBSERVER_H

conflicts with a usage in ESPAsyncWebServer.h:
#ifndef WEBSERVER_H
typedef enum {
  HTTP_GET     = 0b00000001,
  HTTP_POST    = 0b00000010,
  HTTP_DELETE  = 0b00000100,
  HTTP_PUT     = 0b00001000,
  HTTP_PATCH   = 0b00010000,
  HTTP_HEAD    = 0b00100000,
  HTTP_OPTIONS = 0b01000000,
  HTTP_ANY     = 0b01111111,
} WebRequestMethod;
#endif

and that explains why your HTTP_GET etc are not found.  They're not being defined because of your include guard macro.
Changing your code to:
#ifndef XENOSHELL_WEBSERVER_H
#define XENOSHELL_WEBSERVER_H

or something similar will get you past that problem.
Multiply Defined Variables
You also have some non-static variables defined in your webserver.h that will also need to be changed somehow.  A simple change just being to make them static:
static const char* PARAM_INPUT_1 = "input1";
static const char* PARAM_INPUT_2 = "input2";
static const char* PARAM_INPUT_3 = "input3";

IPAddress IP; is only used in main.ino, and should be moved there as a local const IPAddress IP = WiFi.softAPIP();  If you leave it in the header you'll get multiple definitions because of that.
String inputMessage; and String inputParam;   Same problem, only these belong inside your lambda expression in server.on("/get", HTTP_GET, [] (AsyncWebServerRequest * request) {
I don't know why your server variable is in the header either.  The simplest thing to do is put it in webserver.cpp instead and don't pass it in to setup_server, in other word remove the parameter and use the variable defined in the same file as the function.

Having done that your code compiles fine.
Whether or not it works is another question.
I am unable to test that.

47558: <p>I'm trying to do an async webserver with access point using an ESP32.</p>
<p>It's a little bit of a mix between <a href="https://techtutorialsx.com/2018/01/07/esp32-arduino-http-server-over-soft-ap/" rel="nofollow noreferrer">This tutorial</a> for AP and async and <a href="https://randomnerdtutorials.com/esp32-async-web-server-espasyncwebserver-library/" rel="nofollow noreferrer">this tutorial</a> since it's also with an async webserver and it uses inputs which I desperately need.</p>
<p>The part I don't understand is I included all the necessary libraries and I still got this error. If I copy-paste the code in one block everything is fine. It was never necessary to declare <code>HTTP_GET</code> since it should be a variable from a library.</p>
<p>So what's wrong?</p>
<p>These are my errors:</p>
<pre><code>    In file included from C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:467:0,
                     from C:\..\AppData\Local\Temp\arduino_build_497972\sketch\webserver.h:5,
                     from C:\..\Async Webserver ESP32\main\main.ino:3:
    C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h: In constructor 'AsyncCallbackWebHandler::AsyncCallbackWebHandler()':
    C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h:76:49: error: 'HTTP_ANY' was not declared in this scope
         AsyncCallbackWebHandler() : _uri(), _method(HTTP_ANY), _onRequest(NULL), _onUpload(NULL), _onBody(NULL), _isRegex(false) {}
                                                     ^
    In file included from C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:467:0,
                     from C:\..\AppData\Local\Temp\arduino_build_497972\sketch\webserver.h:5,
                     from C:\..\AppData\Local\Temp\arduino_build_497972\sketch\webserver.cpp:1:
    C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h: In constructor 'AsyncCallbackWebHandler::AsyncCallbackWebHandler()':
    C:\..\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h:76:49: error: 'HTTP_ANY' was not declared in this scope
         AsyncCallbackWebHandler() : _uri(), _method(HTTP_ANY), _onRequest(NULL), _onUpload(NULL), _onBody(NULL), _isRegex(false) {}
                                                     ^
    C:\Users\Valentin\AppData\Local\Temp\arduino_build_497972\sketch\webserver.cpp: In function 'void setup_server(AsyncWebServer)':
    webserver.cpp:6:18: error: 'HTTP_GET' was not declared in this scope
       server.on(&quot;/&quot;, HTTP_GET, [](AsyncWebServerRequest * request) {
                      ^
    Multiple libraries were found for &quot;WiFi.h&quot;
     Used: C:\..\Arduino15\packages\firebeetle32\hardware\esp32\0.1.1\libraries\WiFi
     Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
    Using library ESPAsyncWebServer-master at version 1.2.3 in folder: C:\..\Arduino\libraries\ESPAsyncWebServer-master 
    Using library FS at version 1.0 in folder: C:\..\Arduino15\packages\firebeetle32\hardware\esp32\0.1.1\libraries\FS 
    Using library WiFi at version 1.0 in folder: C:\..\Arduino15\packages\firebeetle32\hardware\esp32\0.1.1\libraries\WiFi 
    Using library AsyncTCP-master at version 1.1.1 in folder: C:\..\Arduino\libraries\AsyncTCP-master 
    exit status 1
    'HTTP_GET' was not declared in this scope
</code></pre>
<p>I already tried to use the standard Arduino WiFi library which resulted just in more errors so I switched it back.</p>
<p>I split up the code into three pieces for better visibility.</p>
<p><strong>main.ino</strong></p>
<pre class="lang-cpp prettyprint-override"><code>#include &lt;Arduino.h&gt;
#include &quot;webserver.h&quot;
    
// REPLACE WITH YOUR NETWORK CREDENTIALS
const char* ssid = &quot;blabla&quot;;
const char* password = &quot;blabla&quot;;
    
void setup() {
  Serial.begin(115200);
  WiFi.softAP(ssid, password);
  IP = WiFi.softAPIP();
    
  Serial.println();
  Serial.print(&quot;IP Address: &quot;);
  Serial.println(IP);
      
  setup_server(server);
}

void loop() {}
</code></pre>
<p><strong>webserver.cpp</strong></p>
<pre class="lang-cpp prettyprint-override"><code>#include &quot;webserver.h&quot;
    
void setup_server(AsyncWebServer server) {
  // Send web page with input fields to client
  server.on(&quot;/&quot;, HTTP_GET, [](AsyncWebServerRequest * request) {
    request-&gt;send_P(200, &quot;text/html&quot;, index_html);
  });
    
  // Send a GET request to &lt;ESP_IP&gt;/get?input1=&lt;inputMessage&gt;
  server.on(&quot;/get&quot;, HTTP_GET, [] (AsyncWebServerRequest * request) {
    // GET input1 value on &lt;ESP_IP&gt;/get?input1=&lt;inputMessage&gt;
    if (request-&gt;hasParam(PARAM_INPUT_1)) {
      inputMessage = request-&gt;getParam(PARAM_INPUT_1)-&gt;value();
      inputParam = PARAM_INPUT_1;
    }
    // GET input2 value on &lt;ESP_IP&gt;/get?input2=&lt;inputMessage&gt;
    else if (request-&gt;hasParam(PARAM_INPUT_2)) {
      inputMessage = request-&gt;getParam(PARAM_INPUT_2)-&gt;value();
      inputParam = PARAM_INPUT_2;
    }
    // GET input3 value on &lt;ESP_IP&gt;/get?input3=&lt;inputMessage&gt;
    else if (request-&gt;hasParam(PARAM_INPUT_3)) {
      inputMessage = request-&gt;getParam(PARAM_INPUT_3)-&gt;value();
      inputParam = PARAM_INPUT_3;
    }
    else {
      inputMessage = &quot;No message sent&quot;;
      inputParam = &quot;none&quot;;
    }
    Serial.println(inputMessage);
    request-&gt;send(200, &quot;text/html&quot;, &quot;HTTP GET request sent to your ESP on input field (&quot;
      + inputParam + &quot;) with value: &quot; + inputMessage +
      &quot;&lt;br&gt;&lt;a href=\&quot;/\&quot;&gt;Return to Home Page&lt;/a&gt;&quot;);
    });
    server.onNotFound(notFound);
    server.begin();
  }
    
void notFound(AsyncWebServerRequest *request) {
  request-&gt;send(404, &quot;text/plain&quot;, &quot;Not found&quot;);
}
</code></pre>
<p><strong>webserver.h</strong></p>
<pre class="lang-cpp prettyprint-override"><code>#ifndef WEBSERVER_H
#define WEBSERVER_H
    
#include &quot;Arduino.h&quot;
#include &quot;ESPAsyncWebServer.h&quot;
#include &quot;AsyncTCP.h&quot;
#include &lt;WiFi.h&gt;
    
const char* PARAM_INPUT_1 = &quot;input1&quot;;
const char* PARAM_INPUT_2 = &quot;input2&quot;;
const char* PARAM_INPUT_3 = &quot;input3&quot;;
  
AsyncWebServer server(80);
    
String music_state;
IPAddress IP;
    
String inputMessage;
String inputParam;
    
// HTML web page to handle 3 input fields (input1, input2, input3)
const char index_html[] PROGMEM = R&quot;rawliteral(
&lt;!DOCTYPE HTML&gt;&lt;html&gt;&lt;head&gt;
  &lt;title&gt;ESP Input Form&lt;/title&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
  &lt;/head&gt;&lt;body&gt;
  &lt;form action=&quot;/get&quot;&gt;
    input1: &lt;input type=&quot;text&quot; name=&quot;input1&quot;&gt;
    &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;
  &lt;/form&gt;&lt;br&gt;
  &lt;form action=&quot;/get&quot;&gt;
    input2: &lt;input type=&quot;text&quot; name=&quot;input2&quot;&gt;
    &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;
  &lt;/form&gt;&lt;br&gt;
  &lt;form action=&quot;/get&quot;&gt;
    input3: &lt;input type=&quot;text&quot; name=&quot;input3&quot;&gt;
    &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;
  &lt;/form&gt;
&lt;/body&gt;&lt;/html&gt;)rawliteral&quot;;

void setup_server(AsyncWebServer server);
    
void notFound(AsyncWebServerRequest *request);
    
#endif
</code></pre>
<p>Thanks for the input, I will check back tomorrow and answer all questions and test every suggestion.</p>
 70020: <h2>Macro Conflict</h2>
<p>You have two basic problems here.  The more significant one is that your use of SERVER_H in your include guard:</p>
<pre class="lang-cpp prettyprint-override"><code>#ifndef WEBSERVER_H
#define WEBSERVER_H
</code></pre>
<p>conflicts with a usage in <a href="https://github.com/me-no-dev/ESPAsyncWebServer/blob/f6fff3f91ebf45b91ca4cff2460d2febd61f1e27/src/ESPAsyncWebServer.h#L60" rel="nofollow noreferrer">ESPAsyncWebServer.h</a>:</p>
<pre class="lang-cpp prettyprint-override"><code>#ifndef WEBSERVER_H
typedef enum {
  HTTP_GET     = 0b00000001,
  HTTP_POST    = 0b00000010,
  HTTP_DELETE  = 0b00000100,
  HTTP_PUT     = 0b00001000,
  HTTP_PATCH   = 0b00010000,
  HTTP_HEAD    = 0b00100000,
  HTTP_OPTIONS = 0b01000000,
  HTTP_ANY     = 0b01111111,
} WebRequestMethod;
#endif
</code></pre>
<p>and that explains why your <code>HTTP_GET</code> etc are not found.  They're not being defined because of your include guard macro.</p>
<p>Changing your code to:</p>
<pre class="lang-cpp prettyprint-override"><code>#ifndef XENOSHELL_WEBSERVER_H
#define XENOSHELL_WEBSERVER_H
</code></pre>
<p>or something similar will get you past that problem.</p>
<h2>Multiply Defined Variables</h2>
<p>You also have some non-static variables defined in your webserver.h that will also need to be changed somehow.  A simple change just being to make them static:</p>
<pre class="lang-cpp prettyprint-override"><code>static const char* PARAM_INPUT_1 = &quot;input1&quot;;
static const char* PARAM_INPUT_2 = &quot;input2&quot;;
static const char* PARAM_INPUT_3 = &quot;input3&quot;;
</code></pre>
<p><code>IPAddress IP;</code> is only used in main.ino, and should be moved there as a local <code>const IPAddress IP = WiFi.softAPIP();</code>  If you leave it in the header you'll get multiple definitions because of that.</p>
<p><code>String inputMessage;</code> and <code>String inputParam;</code>   Same problem, only these belong inside your lambda expression in <code>server.on(&quot;/get&quot;, HTTP_GET, [] (AsyncWebServerRequest * request) {</code></p>
<p>I don't know why your server variable is in the header either.  The simplest thing to do is put it in webserver.cpp instead and don't pass it in to <code>setup_server</code>, in other word remove the parameter and use the variable defined in the same file as the function.</p>
<hr />
<p>Having done that your code compiles fine.
Whether or not it works is another question.
I am unable to test that.</p>
