class Print

Hi !

IDE 1.8.5 Mega2560 windows10

I have a lt of errors after spliting my .ino file here's the beginnig :

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:27:0,

from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,

from C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:26,

from sketch\utilethernet.c:5:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Printable.h:25:1: error: unknown type name 'class'

class Print;

^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Printable.h:33:1: error: unknown type name 'class'

class Printable

I suppose to have a "generic mistake"

thx for help

I have a lt of errors after spliting my .ino file

What .ino file or files would that be ?

I dont really understand the question....

I have one program who is working well in one big file named testethernet.ino

For better comfort, I created a new file in wich I've copied some functions (second name is utilethernet.c with header utilethernet.h containing prototypes etc.)

I added #include utilethernet.h in the .ino and includes for Arduino.h, Wire.h, Spi.h and Ethernet.h in the second.

Is that the answer (my english is bit poor ^^)?

max777:
second name is utilethernet.c with header utilethernet.h containing prototypes etc.

You're trying to include C++ headers from C code.
Rename utilethernet.c to utilethernet.cpp.

done ... no change but, if I remove includes from the utilethernet.cpp file the first error is that :

In file included from sketch\utilethernet.c:8:0:

utilethernet.h:6: error: unknown type name 'File'

int htmlPrint(File* fhtml,char* fname,EthernetClient* cli); // sort le contenu du fichier sur cli

^

done ... no change but, if I

post your damned code, we might be able to help!

add #include <Arduino.h> and others into your .cpp

I'm looking how to post file ^^

I discovered something else...

I cant use EthernetClient as type for passing arg in function call...

ex: int htmlPrint(File* fhtml,char* fname,EthernetClient* cli); ...

error is : expected primary-expression before '*'

I'll have some more modifications...

utilethernet.cpp (9.79 KB)

utilethernet.h (1016 Bytes)

utilethernet.cpp (9.79 KB)

utilethernet.h (1016 Bytes)