Get code structured using tabs...

westfw:
If you want the normal Arduino IDE functionality, you should name your tabs "xxx.ino" rather than just "xxx"
Or you can do ".cpp" or ".c", but then you'll need to follow the C/C++ rules about using function prototypes.

Juraj:
one .ino must have the same name as the project folder. it should contain global variables because it is first in the final concatenation of ino files. the rest is concatenated in alphabet order

OK, I finally got it to compile.

I had to have all variables declared and all functions in the first tab.