could not be compiled in 1.0.2, but could, in 1.5.6

Hi, guru,

My Arduino IDE 1.0.2 met a strange problem last night, it compiled the following codes very awfully slowly and in the end it threw out 'Missing the / from the end of a / statement*/', but these codes could be compiled under 1.5.6 without any problem, and moreover, the IDE 1.0.2 could compile the built-in webclient sample, however.

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

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
char server[] = "www.lewei50.com";    // name address for Google (using DNS)
IPAddress ip(192,168,16,177);

EthernetClient client;

void setup() {
  Serial.begin(9600);

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    Ethernet.begin(mac, ip);
  }
  delay(1000);
  Serial.println("connecting www.lewei50.com ...");

  if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    client.println("GET /http://www.lewei50.com/api/v1/sensor/gethistorydata/2558?Order=1&Limit=1&userkey=029b3884b91e4d00b514158b******");
    client.println("Host: www.lewei50.com");
    client.println("Accept: */*");
    client.println("Accept-Encoding: gzip, deflate, compress");
    client.println("User-Agent: runscope/0.1");
    client.println("Connection: close");
    client.println();
  } 
  else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();

    while(true);
  }
}

I have restarted my IDE and even PC already but do not work.

BR,

Ardypro

Do you need this line? I'll guess this is what is causing the compile error.

   client.println("Accept: */*");

Thank you, the problem is just you pointed out. :slight_smile:

I am not sure at the moment whether this line is a must, it is included in the response headers returned from the server, however.

Change the string to use its ascii codes rather than the actual character, should trick the IDE into working.

client.println("Accept: \x2A/\x2A");