Ethernet + SD Tutorial Issue
Moderators: adafruit_support_bill, adafruit

Ethernet + SD Tutorial Issue

by HWW on Wed Dec 21, 2011 1:30 pm

I've seen multiple tutorials online and I've noticed some are outdated, due to the newer Arduino software release...
I'm still learning the language so I can't pinpoint the issue.

So here's my issue:

I have an Arduino Uno with an Ethernet Shield.
I was trying to test out this sketch from the online tutorial ("http://www.ladyada.net/learn/arduino/ethfiles.html")
code=("https://raw.github.com/adafruit/SDWebBrowse/master/SDWebBrowse.pde")

and I've tried to upload/verify, only to get this error: "cannot declare parameter 'client' to be of abstract type 'Client'"

Along with:
----------------

sketch_dec22b:14: error: cannot declare parameter 'client' to be of abstract type 'Client'
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:7: note: because the following virtual functions are pure within 'Client':
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:12: note: virtual size_t Client::write(uint8_t)
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:13: note: virtual size_t Client::write(const uint8_t*, size_t)
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:14: note: virtual int Client::available()
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:15: note: virtual int Client::read()
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:17: note: virtual int Client::peek()
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:18: note: virtual void Client::flush()
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:10: note: virtual int Client::connect(IPAddress, uint16_t)
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:11: note: virtual int Client::connect(const char*, uint16_t)
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:16: note: virtual int Client::read(uint8_t*, size_t)
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:19: note: virtual void Client::stop()
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:20: note: virtual uint8_t Client::connected()
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:21: note: virtual Client::operator bool()
sketch_dec22b:18: error: no matching function for call to 'Server::Server(int)'

As of Arduino 1.0, the Server class in the Ethernet library has been renamed to EthernetServer.

C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Server.h:4: note: candidates are: Server::Server()
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Server.h:4: note: Server::Server(const Server&)
sketch_dec22b:18: error: cannot declare variable 'server' to be of abstract type 'Server'
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Server.h:4: note: because the following virtual functions are pure within 'Server':
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: note: virtual size_t Print::write(uint8_t)
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Server.h:6: note: virtual void Server::begin()
sketch_dec22b:80: error: cannot declare parameter 'client' to be of abstract type 'Client'
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:7: note: since type 'Client' has pure virtual functions
sketch_dec22b.cpp: In function 'void loop()':
sketch_dec22b:147: error: 'class Server' has no member named 'available'
sketch_dec22b:147: error: cannot declare variable 'client' to be of abstract type 'Client'
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:7: note: since type 'Client' has pure virtual functions
sketch_dec22b:186: error: cannot allocate an object of abstract type 'Client'
C:\Documents and Settings\User\My Documents\Downloads\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Client.h:7: note: since type 'Client' has pure virtual functions

---------------------

I've also tried the "Replace 'Server' with 'EthernetServer' and 'Client' with 'EthernetClient'" as I've seen on other sketch's and forums.


Anyone know what I'm failing to correct?
HWW
 
Posts: 2
Joined: Wed Dec 21, 2011 1:15 pm

Re: Ethernet + SD Tutorial Issue

by adafruit on Thu Dec 22, 2011 10:37 am

our version of the code needs a 1.0 update - please hold tight while we rewrite all the code :) there isnt an ETA for when we'll be able to redo it but probably after the new year
User avatar
adafruit
 
Posts: 11683
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Ethernet + SD Tutorial Issue

by HWW on Fri Dec 23, 2011 6:01 am

I had thought that be the case, but I didn't want to make wrongful assumptions. Glad I wasn't.
And thank you.
HWW
 
Posts: 2
Joined: Wed Dec 21, 2011 1:15 pm

Re: Ethernet + SD Tutorial Issue

by DrWaX on Thu Jan 05, 2012 6:31 am

Hello, I encountered the same problem with Arduino Ethernet and I here is my solution :

Add :

#include <SPI.h>

Transform :

Server server(80); -> EthernetServer server(80);
void ListFiles(Client client, uint8_t flags) -> void ListFiles(EthernetClient client, uint8_t flags)
Client client = server.available(); -> EthernetClient client = server.available();

No compilations errors, upload OK, test OK.

UPDATE :

client.print display characters with their ASCII code, use client.write instead.
DrWaX
 
Posts: 3
Joined: Thu Jan 05, 2012 6:18 am

Re: Ethernet + SD Tutorial Issue

by MRElisei on Sat Feb 04, 2012 7:54 pm

Hi DrWaX,

Thanks for the information.

I made the changes you said.
Now I am with the following message

Can you help?

Image
MRElisei
 
Posts: 2
Joined: Sat Feb 04, 2012 7:49 pm

Re: Ethernet + SD Tutorial Issue

by DrWaX on Tue Feb 14, 2012 7:51 am

Did you try client.write("") in place of client.write(), may be the argument is mandatory.
DrWaX
 
Posts: 3
Joined: Thu Jan 05, 2012 6:18 am

Re: Ethernet + SD Tutorial Issue

by MRElisei on Mon Feb 20, 2012 9:04 am

DrWaX wrote:Did you try client.write("") in place of client.write(), may be the argument is mandatory.



Hi DrWaX,

Thanks for the help.

See it now:
Image
MRElisei
 
Posts: 2
Joined: Sat Feb 04, 2012 7:49 pm

Re: Ethernet + SD Tutorial Issue

by DrWaX on Mon Feb 20, 2012 10:40 am

#include <SPI.h> seems missing in the declaration of libraries, isn't it ?
DrWaX
 
Posts: 3
Joined: Thu Jan 05, 2012 6:18 am

Re: Ethernet + SD Tutorial Issue

by mkanoap on Tue Feb 28, 2012 12:57 pm

Here is how I updated a sketch I have (implements a web server to control relays in a stop light) to 1.0 while retaining backward compatibility

1) Replace every instance of "Client" with "EthernetClient"
2) Replace every instance of "Server" with "EthernetServer"
3) add this block near the beginning:
Code: Select all | TOGGLE FULL SIZE
   // make backwardly compatable
   #if ARDUINO < 100
       #define EthernetClient Client
       #define EthernetServer Server
   #endif

Step three is optional if you never need to have it compile in the older IDE.

My code already used client.print("some stuff to print"), always using quotes, instead of client.write() so there were no other changes to make. ymmv
mkanoap
 
Posts: 19
Joined: Tue Sep 16, 2008 3:01 pm
Location: Cincinnati