Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
894 views
in Technique[技术] by (71.8m points)

arduino - HTTP_GET, was not declared in this scope

While compiling my rather simple project I get an error that I'm unable to resolve. The included libraries are:

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

And the error that HTTP_GET was not declared in this scope concerns the following line :

message += (server.method() == HTTP_GET) ? "GET" : "POST";

I'm using an ESP32 module produced by AZDelivery, the board is selected and other simple projects (like blinking the internal LED) word like a charm.

Any ideas how to solve this would be appreciated

EDIT: below is the full error message as thrown in Arduino IDE (on macos)

Users/yannickgery/Documents/Arduino/controlservo/controlservo.ino: In function 'void handleNotFound()':
controlservo:156:34: error: 'HTTP_GET' was not declared in this scope
   message += (server.method() == HTTP_GET) ? "GET" : "POST";
                                  ^
/Users/yannickgery/Documents/Arduino/controlservo/controlservo.ino: In function 'void setup()':
controlservo:206:23: error: 'HTTP_GET' was not declared in this scope
   server.on("/motor", HTTP_GET, motorControl);           
                       ^
Multiple libraries were found for "WiFi.h"
 Used: /Users/yannickgery/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
 Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi
exit status 1
'HTTP_GET' was not declared in this scope
question from:https://stackoverflow.com/questions/65919148/http-get-was-not-declared-in-this-scope

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Assuming you're using the HTTP methods defined in this arduino-esp32 library then perhaps you have a very old version of it? Try including this file directly with #include "HTTP_Method.h", see if it surfaces #include errors (in which case you have a very old version) or fixes your problem (maybe you have several files of the same name in the include path?).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...