Skip to content

Example compilation error - Arduino Ethernet Library (EthernetServer) on ESP32 #5

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

Closed
seansplayin opened this issue Feb 5, 2024 · 1 comment

Comments

@seansplayin
Copy link

C:\Users\seans\Documents\Arduino\libraries\SparkFun_WebServer_ESP32_W5500\examples\Example1_AsyncWebServer\Example1_AsyncWebServer.ino: In function 'void loop()':
C:\Users\seans\Documents\Arduino\libraries\SparkFun_WebServer_ESP32_W5500\examples\Example1_AsyncWebServer\Example1_AsyncWebServer.ino:210:43: error: invalid new-expression of abstract class type 'EthernetServer'
ethernetServer = new EthernetServer(80); //Instantiate the web server. Use port 80
^
In file included from C:\Users\seans\Documents\Arduino\libraries\SparkFun_WebServer_ESP32_W5500\examples\Example1_AsyncWebServer\Example1_AsyncWebServer.ino:52:
c:\Users\seans\Documents\Arduino\libraries\Ethernet\src/Ethernet.h:254:7: note: because the following virtual functions are pure within 'EthernetServer':
class EthernetServer : public Server {
^~~~~~~~~~~~~~
In file included from C:\Users\seans\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:182,
from C:\Users\seans\Documents\Arduino\libraries\SparkFun_WebServer_ESP32_W5500\examples\Example1_AsyncWebServer\Example1_AsyncWebServer.ino:16:
C:\Users\seans\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Server.h:28:18: note: 'virtual void Server::begin(uint16_t)'
virtual void begin(uint16_t port=0) =0;
^~~~~
Multiple libraries were found for "Ethernet.h"
Used: C:\Users\seans\Documents\Arduino\libraries\Ethernet
Not used: C:\Users\seans\AppData\Local\Arduino15\libraries\Ethernet
Not used: C:\Users\seans\Documents\Arduino\libraries\UIPEthernet
Not used: C:\Users\seans\Documents\Arduino\libraries\EthernetENC
exit status 1

Compilation error: invalid new-expression of abstract class type 'EthernetServer'

@PaulZC
Copy link
Collaborator

PaulZC commented Feb 5, 2024

Hi @seansplayin ,

Thanks for reporting this.

The compilation error actually comes from the Arduino Ethernet Library and is discussed in this issue. The solution is to patch Server.h. Replace C:\Users\<Your User>\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32\Server.h with the modified copy here and all will be well.

I will pin this issue to make it easier to find.

Best wishes,
Paul

@PaulZC PaulZC changed the title Compilation error Compilation error - Arduino Ethernet Library (EthernetServer) on ESP32 Feb 5, 2024
@PaulZC PaulZC closed this as completed Feb 5, 2024
@PaulZC PaulZC pinned this issue Feb 5, 2024
@PaulZC PaulZC changed the title Compilation error - Arduino Ethernet Library (EthernetServer) on ESP32 Example compilation error - Arduino Ethernet Library (EthernetServer) on ESP32 Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants