I am facing the error arduino first defined here while trying to compile my code, I think that the reason is that my class needs to have access to some variables that are defined in the header of my main skecht.ino. Simplifying I have something like this
main .ino
#include "myLibt.h"
setup(){
//setup something
}
loop(){
//loop something
}
myLibs.h looks like
#include <Arduino.h>
int x;
int y;
int z;
then I have my class that needs to access x, y and z from myLibs.h, if I do as below, including myLibs.h in the class, while compiling I get the error mentioned (arduino first defined here) for each of the variables of myLibs.h that I use. (Notice that the operations of my class are just examples)
#incldue "myLibs.h"
class A{
int a;
int b;
void m1();
void m2(){
x = a + x;
z = b * z;
}
}
Why do I have that error and how I can fix it?
Thanks in advance,
Regards