Struggling compiling a project

Hi,

This is my first experience with arduino and I am struggling to compile an example project...

I am using windows 8.1 x64, Arduino IDE 1.0.5 enhanced edition, an Arduino Nano v3 (328) and an ENC28J60 module.

The code example I am trying to compile is https://github.com/thiseldo/EtherShield_RESTduino

The error I get when I verify it is:

In file included from EtherCard_RESTduino.ino:19: EtherCard.h:139: error: expected class-name before '{' token EtherCard_RESTduino:40: error: 'Ethernet' has not been declared EtherCard_RESTduino:44: error: 'NanodeMAC' does not name a type EtherCard_RESTduino.ino: In function 'uint16_t http200ok()': EtherCard_RESTduino:52: error: 'class EtherCard' has no member named 'tcpOffset' EtherCard_RESTduino.ino: In function 'uint16_t http404()': EtherCard_RESTduino:63: error: 'class EtherCard' has no member named 'tcpOffset' EtherCard_RESTduino.ino: In function 'uint16_t print_webpage()': EtherCard_RESTduino:74: error: 'class EtherCard' has no member named 'tcpOffset' EtherCard_RESTduino.ino: In function 'int16_t process_request(char*)': EtherCard_RESTduino:242: error: 'class EtherCard' has no member named 'tcpOffset' EtherCard_RESTduino.ino: In function 'void setup()': EtherCard_RESTduino:272: error: 'Ethernet' has not been declared EtherCard_RESTduino.ino: In function 'void loop()': EtherCard_RESTduino:294: error: 'class EtherCard' has no member named 'packetReceive' EtherCard_RESTduino:303: error: 'Ethernet' was not declared in this scope EtherCard_RESTduino:303: error: expected primary-expression before 'char' EtherCard_RESTduino:303: error: expected )' before 'char' EtherCard_RESTduino:317: error: expected)' before ';' token

Can someone guide me through what I am doing wrong, any help will be much appreciated :)

Many thanks

Andy

Which file exactly are you trying to compile?

Hi,

The EtherShield_RESTduino.pde

I have also tried from the GitHub - thiseldo/EtherCardExamples: New examples for EtherCard ENC28J60 library using the EtherCard_RESTduino example and I get basically the same thing this time running the “EtherCard_RESTduino.ino”:

In file included from EtherCard_RESTduino.ino:19:
EtherCard.h:139: error: expected class-name before ‘{’ token
EtherCard_RESTduino:40: error: ‘Ethernet’ has not been declared
EtherCard_RESTduino:44: error: ‘NanodeMAC’ does not name a type
EtherCard_RESTduino.ino: In function ‘uint16_t http200ok()’:
EtherCard_RESTduino:52: error: ‘class EtherCard’ has no member named ‘tcpOffset’
EtherCard_RESTduino.ino: In function ‘uint16_t http404()’:
EtherCard_RESTduino:63: error: ‘class EtherCard’ has no member named ‘tcpOffset’
EtherCard_RESTduino.ino: In function ‘uint16_t print_webpage()’:
EtherCard_RESTduino:74: error: ‘class EtherCard’ has no member named ‘tcpOffset’
EtherCard_RESTduino.ino: In function ‘int16_t process_request(char*)’:
EtherCard_RESTduino:242: error: ‘class EtherCard’ has no member named ‘tcpOffset’
EtherCard_RESTduino.ino: In function ‘void setup()’:
EtherCard_RESTduino:272: error: ‘Ethernet’ has not been declared
EtherCard_RESTduino.ino: In function ‘void loop()’:
EtherCard_RESTduino:294: error: ‘class EtherCard’ has no member named ‘packetReceive’
EtherCard_RESTduino:303: error: ‘Ethernet’ was not declared in this scope
EtherCard_RESTduino:303: error: expected primary-expression before ‘char’
EtherCard_RESTduino:303: error: expected )' before 'char' EtherCard_RESTduino:317: error: expected )’ before ‘;’ token

To note the project in this second example includes all the reference libraries when I open it i.e. EtherCard.h, EtherShield.h, enc28j60.h, net.h.

Many thanks,

Andy

have you the EtherCard ENC28J60 library (properly) installed ?

https://github.com/jcw/ethercard

I think so, but this is my first go so don't quote me.

Please can you explain how to "properly" install a library?

The second example with the .ino seemed to load in all the libraries in to the ide for me, can I assume this is loaded properly?

I simply downloaded the referenced example and ran the .ino file, is that wrong?

I have also followed: http://arduino.cc/en/Guide/Libraries and added the ethercard library to my list of libraries.

Many thanks,

Andy

the .h files (and other library files ;) ) should be in the "libraries/EtherCard/" folder , do you see them there ?

Hi,

I have C:\Program Files (x86)\Arduino\libraries\EtherCard

and

C:\Program Files (x86)\Arduino\Arduino ERW 1.0.5\libraries\EtherCard

I didn't have it under the second so I added it in and recompiled, now I get the following:

In file included from /EtherCard.h:1, from EtherCard_RESTduino.ino:19: enc28j60.h:18: error: 'uint8_t' does not name a type enc28j60.h:19: error: 'uint16_t' does not name a type enc28j60.h:21: error: ISO C++ forbids declaration of 'uint8_t' with no type enc28j60.h:21: error: expected ';' before '' token enc28j60.h:23: error: expected `;' before 'static' enc28j60.h:24: error: 'uint8_t' does not name a type enc28j60.h:28: error: 'uint16_t' has not been declared enc28j60.h:29: error: 'uint16_t' does not name a type enc28j60.h:31: error: 'uint8_t' has not been declared enc28j60.h:31: error: expected ',' or '...' before '' token enc28j60.h:31: error: ISO C++ forbids declaration of 'uint8_t' with no type enc28j60.h:32: error: 'uint8_t' has not been declared enc28j60.h:32: error: 'uint8_t' has not been declared enc28j60.h:33: error: 'uint8_t' does not name a type enc28j60.h:41: error: 'uint8_t' does not name a type EtherCard_RESTduino:40: error: 'byte ENC28J60::buffer [700]' is not a static member of 'class ENC28J60' EtherCard_RESTduino:44: error: 'NanodeMAC' does not name a type EtherCard_RESTduino.ino: In function 'uint16_t http200ok()': EtherCard_RESTduino:52: error: 'class EtherCard' has no member named 'tcpOffset' EtherCard_RESTduino.ino: In function 'uint16_t http404()': EtherCard_RESTduino:63: error: 'class EtherCard' has no member named 'tcpOffset' EtherCard_RESTduino.ino: In function 'uint16_t print_webpage()': EtherCard_RESTduino:74: error: 'class EtherCard' has no member named 'tcpOffset' EtherCard_RESTduino.ino: In function 'int16_t process_request(char*)': EtherCard_RESTduino:242: error: 'class EtherCard' has no member named 'tcpOffset' EtherCard_RESTduino.ino: In function 'void setup()': EtherCard_RESTduino:272: error: 'buffer' is not a member of 'Ethernet' EtherCard_RESTduino.ino: In function 'void loop()': EtherCard_RESTduino:294: error: 'class EtherCard' has no member named 'packetReceive' EtherCard_RESTduino:303: error: 'buffer' is not a member of 'Ethernet' EtherCard_RESTduino:310: error: 'buffer' is not a member of 'Ethernet' EtherCard_RESTduino:317: error: 'buffer' is not a member of 'Ethernet'

weird :roll_eyes: I gave it a try and didn't get these errors. I had other errors (some functions not being members of some class ) , which make me think that the library has been updated but the examples have not. I'll try to have a closer look tomorrow

Thanks I look forward to your reply :)

Hi, I did put all the library files in \myDocuments\arduino\libraries\EtherCard\ , copy/paste the example code, and got an error about undefined NanodeMAC --> I commented the lines

#ifdef NANODE
//NanodeMAC mac( mymac );
#endif

and tried again. This time I got the following errors (only the first 2 reported here ;) )

sketch_dec03a.cpp.o: In function loop': C:\ard5\arduino-1.5.2/sketch_dec03a.ino:294: undefined reference toEtherCard::packetLoop(unsigned int)' C:\ard5\arduino-1.5.2/sketch_dec03a.ino:321: undefined reference to `EtherCard::httpServerReply(unsigned int)'

line 294 is :

 dat_p=ether.packetLoop(ether.packetReceive());

normal..... in the file ethercard.h, the EtherCard class doesn't contain any packetReceive() function.

I'm afraid my previous guess is right . The examples files are 2years old, the library changed 5 months ago....

In the words of homer simpson, "Doh!".

Just a thought but could the missing functions be replaced in the code? I guess they may have been super seeded with some new functions that do similar things right?

Cheers,

Andy

I played with Ethercard a while ago. The library should be in your sketch directory, do not copy that in the Arduino program tree (c:/Program...).

So assuming a new Arduino 1.0.5 installation, you should have in "My documents" an "arduino" directory to put your sketches, and a libraries directory with a readme.txt pointing to http://arduino.cc/en/Guide/Libraries

If you put your Ethercard library only there, it should work.