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
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;
}
}
UKHeliBob:
Have you deliberately created your own main.ino program to replace the hidden one that the IDE normally uses ?
Where is "here" ?
No I haven't done that, the "here" comes from this error
C:\Users\j\AppData\Local\Temp\arduino_build_416253\sketch\qPayload.ino.cpp.o:(.data.gPercentage+0x0): multiple definition of gPercentage'* *C:\Users\j\AppData\Local\Temp\arduino_build_416253\sketch\aPayload.cpp.o:(.data.gPercentage+0x0): first defined here* *C:\Users\j\AppData\Local\Temp\arduino_build_416253\sketch\qPayload.ino.cpp.o: In function loop':
It complains of gPercentage which is defined on qPayload.h tha is included in the main qPayload.ino
but I use that variable as well in aPayload.cpp file