How to use an "external structure" from an "external file"?

Hello, I have defined and structure in the main skectch and I can use it, however I would like to have it in an external file to be imported, I am an new on it and I can not get it.

I MOVE the struct to another file named estructura.h, I put it inside libraries folder in his own folder with the same name (estructura) and I import like this in the main sketch: #include <estructura.h>

... however I get errors... with types and similar when I just copy (obviusly deleting in the main skecth).

More info: I am getting errors about boolean..... (As I told you, it works perfect from the main sketch)

content of estructura.h

enum btipo {
men,
luz,
per,
gen,
esc,
};

struct TBoton
{ char nombrebt[13]; de fin
// char etiqueta[13];
boolean estado;
btipo tipoboton;
boolean regulado;
int valorreg;
};

struct TZona
{
char nzona[13];
TBoton boton[8];
};
struct MSite
{
char nsite[13];
TZona mizona[6];
};

error:

In file included from pruestructura.ino:2:0:
C:\Users\Pascual\Documents\Arduino\libraries\estructura/estructura.h:13:3: error: 'boolean' does not name a type
boolean estado; //estado del boton
^
C:\Users\Pascual\Documents\Arduino\libraries\estructura/estructura.h:15:3: error: 'boolean' does not name a type
boolean regulado; //si es o no boton regulable
^
pruestructura:16: error: too many initializers for 'TBoton'
pruestructura:16: error: cannot convert 'bool' to 'btipo' in initialization
pruestructura:17: error: too many initializers for 'TBoton'........

C:\Users\Pascual\Documents\Arduino\libraries\estructura/estructura.h:13:3: error: 'boolean' does not name a type

Is there some part of this message that you don't understand? Why ARE you using a non-standarn type in the struct?

Hello Paul... the type is standard... .just boolean... in fact, these definition work perfect if I copy back the structure to the main skectch...

I think it may be relationated with "problems using/defining the file estructure.h" and give a "strange error"

It depends on what you mean by "standard".
bool is the C++ standard type.
boolean is defined in Arduino.h.

Just add "#include <Arduino.h> to the header file.

Regards,
Ray L.

Not sure what de fin is:

struct TBoton
{ char nombrebt[13];  de fin  // <----- de fin ???
//  char etiqueta[13]; 
  boolean estado; 
  btipo tipoboton;
  boolean regulado; 
  int valorreg;
 };

RayLivingston:
Just add "#include <Arduino.h> to the header file.

Regards,
Ray L.

Eiii, thank you very much, it solves the problem. But

Could you explain why is it necessary???

pabusa:
Eiii, thank you very much, it solves the problem. But

Could you explain why is it necessary???

Because "boolean" is not a native c/c++ type. It is defined in Arduino.h. If you don't want to include Arduino.h, then simply use "bool", which is a native c/c++ type instead of "boolean".

Regards,
Ray L.

RayLivingston:
Because "boolean" is not a native c/c++ type. It is defined in Arduino.h. If you don't want to include Arduino.h, then simply use "bool", which is a native c/c++ type instead of "boolean".

Regards,
Ray L.

Ummm, ok, it is really curious, so to use the native type ... (boolean) I need to import... it is like "think the opposite"

Thank you!!

pabusa:
Ummm, ok, it is really curious, so to use the native type ... (boolean) I need to import... it is like "think the opposite"

Thank you!!

No, you said that exactly backwards. boolean is NOT native, bool is native. You have to DEFINE any type before you can declare a variable of that type. bool is defined in the c language, so you can always use it. boolean is defined in Arduino.h, so you can use it ONLY if you include Arduino.h.

Regards,
Ray L.