-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2.4.0 - ESP8266WebServer missing #4085
Comments
Please post the (preferably minimal) sketch which has this problem. |
Unfortunately the sketch is large. Perhaps an excerpt will be sufficient. If not here is a link to the whole sketch. Here is a link to the whole sketch: excerpt: ESP8266WebServer server = ESP8266WebServer(port);// create a web server on port 8021 /------------------------------startServerFUNCTIONS----------------------------------/ void startServer() { // Start a HTTP server with a file read handler and an upload handler server.onNotFound(handleNotFound); // if someone requests any other file or page, go to function 'handleNotFound' server.begin(); // start the HTTP server void setup() { |
Indeed, the issue is with Is there some specific reason why you need to use assignment here, rather than just |
Probably not. I will test it with this change tomorrow. There are many sample sketches around with the syntax I used. |
Worked fine when using v2.4.0 and Thanks |
@igrr The compiler seems to think that the copy constructor is deleted, but I don't see that explicitly done in the class. AFAIK, the default copy constructor for a class T is implicitly deleted if one of these conditions is met:
Ref: cppreference WiFi has multiple inheritance, but I don't see 2, 3, 4, 5, or 6 anywhere, so my guess is 1.: some member was added that the compiler thinks has a non-trivial constructor. |
That's ESP8266WebServer, not WiFi class. It has a Possible solutions are: a) Replace unique_ptr with shared_ptr, make copying possible. This will allow the OPs use case to work, but would allow silent copying of ESP8266WebServer object. Since this object contains some pointers which are managed manually, in general copying it is not a safe thing to do. b) Implement move constructor — i think this will also allow the OPs use case to work (not sure, need to check). c) Don't allow copying at all. This will require the existing sketches to be updated as mentioned above. |
I read ESP8266WebServer but my brain registered ESP8266WiFi. Ok, enough for today, getting some sleep now :p |
Do you have any workaround I may use here: |
I think if you change the line |
Won't work. WrapperWebconfig.h:83: error: expected identifier before numeric constant |
I too am having issues with this change
A way to change the port would be ideal, but this workaround doesn't work anymore with this change |
Found a workaround Had to change
to
Had to change all syntax from |
@mdhiggins you have to delete the pointer before doing another new, or it will leak. |
@devyte good point, I just never initialized the first 'new' and removed the conditional to check if the defaultport is set. Do I still need to delete? That would be the first time the server pointer is initialized |
Init the ptr to nullptr, then check it right before you new it if !=nullptr. If so, delete it. |
@chun48 rc2 was a release candidate, and is now superseded by 2.4.0. |
Referenced pr is #2716 , adds a begin(port) method. |
Ok, created PR #4148 for the port method. |
@bill-orange ESP8266WebServer _server(80) is working in my case |
Closed via #4148 . Don't use.copy constructor anymore, it's still disallowed. |
Same problem with version 2.4.1 |
@Kermit66 have you tried the erase flash options ? |
Yes always delete the memory |
Hardware: Wemos R2
Core Version: unknown
Description: (see below)
My sketch worked fine with v2.3.0. compiling with 2.4.0 I get:
use of deleted function 'ESP8266WebServer::ESP8266WebServer(const ESP8266WebServer&)
compiling with: 2.4.0 vs 2.3.0
Problem description: Can not compile
Settings in IDE
Module: ESPDurino D2 mini
Flash Size: 4 MB
CPU Frequency: 80Mhz
The text was updated successfully, but these errors were encountered: