Go Down

Topic: error: 'byte' does not name a type (Read 9 times) previous topic - next topic

Carson C.

Jan 26, 2009, 02:30 am Last Edit: Jan 26, 2009, 02:30 am by cscade Reason: 1
I'm trying to compile the example code for the Arduino Ethernet shield on my new Illuminato, and I'm getting this error:

error: 'byte' does not name a type In function 'void setup()':

The example code is from the playground;
Code: [Select]
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
byte server[] = { 64, 233, 187, 99 }; // Google

Client client(server, 80);

void setup()
{
 Ethernet.begin(mac, ip);
 Serial.begin(9600);

 delay(1000);

 Serial.println("connecting...");

 if (client.connect()) {
   Serial.println("connected");
   client.println("GET /search?q=arduino HTTP/1.0");
   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();
   for(;;)
     ;
 }
}


The highlighted line is byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

I'm assuming something is borked in the Illuminato core files, since it will compile fine if I select another board than the Illuminato. Unfortunately, I have only a vague idea what the "core files" actually do, and I'm way out of my league to debug this. The liquidware guys seem to be otherwise engaged, so I'm hoping to find some insight here! I'd really like to be able to play with my Ethernet shield!

Thanks for your help!
I hope I don't blow myself up.

acleone

#1
Jan 26, 2009, 11:32 am Last Edit: Jan 26, 2009, 11:33 am by acleone Reason: 1
above the #include, try throwing in:
Code: [Select]
#define byte uint8_t

or just change all the byte's to uint8_t

AlphaBeta

I'll prosume the previous poster ment:
Code: [Select]
#define uint8_t byte
or
Code: [Select]
#define unsigned char byte

?

Carson C.

#3
Jan 26, 2009, 01:47 pm Last Edit: Jan 26, 2009, 01:48 pm by cscade Reason: 1
Thank you for the responses! Unfortunately, this solved the issue in the scope of my sketch, but uncovered many more compile errors. I'll post them here, but would not be surprised if I just need to sit on my hands and wait for updated core files  :-[
Code: [Select]



In file included from /usr/local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/include/util/delay.h:39,

                from /usr/local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/include/avr/delay.h:37,

                from /Applications/arduino-0012LW/hardware/cores/illuminato/wiring.h:7,

                from /Applications/arduino-0012LW/hardware/cores/illuminato/WProgram.h:8,

/usr/local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/include/util/delay_basic.h:65: error: variable or field '_delay_loop_1' declared void

/usr/local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/include/util/delay_basic.h:65: error: 'byte' was not declared in this scope

/usr/local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/include/util/delay_basic.h:81: error: variable or field '_delay_loop_1' declared void

/usr/local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/include/util/delay_basic.h:81: error: 'byte' was not declared in this scope

In file included from /usr/local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/include/avr/delay.h:37,

                from /Applications/arduino-0012LW/hardware/cores/illuminato/wiring.h:7,

                from /Applications/arduino-0012LW/hardware/cores/illuminato/WProgram.h:8,

In function 'void setup()':


I hope I don't blow myself up.

Carson C.

@acleone Thanks, this worked!  :D I tried AlphaBeta's response first, and never tried yours until now.

Compiles just fine. Can you give me some deeper insight into what is going on here behind the scenes? Should this define statement exist somewhere in the Illuminato core files, such that I can add it myself and avoid this particular gotcha?
I hope I don't blow myself up.

Go Up