Ethernet examples not compiling

Hi, I'm new here, but not to Arduino. I just updated to Arduino 1.0 and tried to build the ChatServer example. I get error messages like these...

In file included from /Users/marktrayle/Documents/Arduino/libraries/Ethernet/Ethernet.h:5, from ChatServer.cpp:8: /Users/marktrayle/Documents/Arduino/libraries/Ethernet/Client.h:17: error: conflicting return type specified for 'virtual void Client::write(uint8_t)' /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)' /Users/marktrayle/Documents/Arduino/libraries/Ethernet/Client.h:19: error: conflicting return type specified for 'virtual void Client::write(const uint8_t*, size_t)'

... etc., etc. etc.

This looks like some sort of version problem to me. I've removed Arduino preferences and older versions of the IDE, then reinstalled the latest version. No luck. Any ideas? thanks, Mark

The Ethernet library had some naming changes in 1.0, the IDE pointed them out when I loaded an old sketch and prompted me to rename them.

Everything now starts with "Ethernet"

Post the code...

Ah, I was using an older version of the ChatServer example. This is what I have for the
latest version…
(also doesn’t compile, error messages below source)

/*
Chat Server

A simple server that distributes any incoming messages to all
connected clients. To use telnet to your device’s IP address and type.
You can see the client’s input in the serial monitor as well.
Using an Arduino Wiznet Ethernet shield.

Circuit:

  • Ethernet shield attached to pins 10, 11, 12, 13
  • Analog inputs attached to pins A0 through A5 (optional)

created 18 Dec 2009
by David A. Mellis
modified 10 August 2010
by Tom Igoe

*/

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 177);
IPAddress gateway(192,168,1, 1);
IPAddress subnet(255, 255, 0, 0);

// telnet defaults to port 23
EthernetServer server(23);
boolean gotAMessage = false; // whether or not you got a message from the client yet

void setup() {
// initialize the ethernet device
Ethernet.begin(mac, ip, gateway, subnet);
// start listening for clients
server.begin();
// open the serial port
Serial.begin(9600);
}

void loop() {
// wait for a new client:
EthernetClient client = server.available();

// when the client sends the first byte, say hello:
if (client) {
if (!gotAMessage) {
Serial.println(“We have a new client”);
client.println(“Hello, client!”);
gotAMessage = true;
}

// read the bytes incoming from the client:
char thisChar = client.read();
// echo the bytes back to the client:
server.write(thisChar);
// echo the bytes to the server as well:
Serial.print(thisChar);
}
}

---------- error messages ------------

In file included from /Users/marktrayle/Documents/Arduino/libraries/Ethernet/Ethernet.h:5,
from ChatServer.cpp:21:
/Users/marktrayle/Documents/Arduino/libraries/Ethernet/Client.h:17: error: conflicting return type specified for ‘virtual void Client::write(uint8_t)’
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:48: error: overriding ‘virtual size_t Print::write(uint8_t)’
/Users/marktrayle/Documents/Arduino/libraries/Ethernet/Client.h:19: error: conflicting return type specified for ‘virtual void Client::write(const uint8_t*, size_t)’
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:50: error: overriding ‘virtual size_t Print::write(const uint8_t*, size_t)’
In file included from /Users/marktrayle/Documents/Arduino/libraries/Ethernet/Ethernet.h:6,
from ChatServer.cpp:21:
/Users/marktrayle/Documents/Arduino/libraries/Ethernet/Server.h:20: error: conflicting return type specified for ‘virtual void Server::write(uint8_t)’
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:48: error: overriding ‘virtual size_t Print::write(uint8_t)’
/Users/marktrayle/Documents/Arduino/libraries/Ethernet/Server.h:22: error: conflicting return type specified for ‘virtual void Server::write(const uint8_t*, size_t)’
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:50: error: overriding ‘virtual size_t Print::write(const uint8_t*, size_t)’
ChatServer:26: error: ‘IPAddress’ does not name a type
ChatServer:27: error: ‘IPAddress’ does not name a type
ChatServer:28: error: ‘IPAddress’ does not name a type
ChatServer:31: error: ‘EthernetServer’ does not name a type
ChatServer.cpp: In function ‘void setup()’:
ChatServer:36: error: ‘ip’ was not declared in this scope
ChatServer:36: error: ‘gateway’ was not declared in this scope
ChatServer:36: error: ‘subnet’ was not declared in this scope
ChatServer:38: error: ‘server’ was not declared in this scope
ChatServer.cpp: In function ‘void loop()’:
ChatServer:45: error: ‘EthernetClient’ was not declared in this scope
ChatServer:45: error: expected `;’ before ‘client’
ChatServer:48: error: ‘client’ was not declared in this scope
ChatServer:58: error: ‘server’ was not declared in this scope

Did you use the chatserver code included in the arduino 1.0 examples? I just tried it and it compiled without issues. Hopefully if you upgraded from an older IDE, you put the new 1.0 IDE in a new folder so the librarys don't get mixed.

I fired up Arduino 1.0, copied your code, pasted it into the IDE, and compiled. The "error" I got was:

Binary sketch size: 10824 bytes (of a 30720 byte maximum)

Thanks for the clue, zoomkat.