Trouble finding a function in a multi-file project using the arduino-cli

Hi everyone,
I am making a multi-file project and, as I kinda expected, I am getting an error which has to do with the multi-file nature of the project, the problem is that I can't figure it out.

I am using the arduino-cli version 0.10.0

the project is in the directory transmitter, the main.ino is in the main directory,
automation.cpp and automation.h are in the automation folder.

the function which generates the problem is called in the setup() and it is basically a loop which initializes certain variables.

The project also contains a class and anogther function in the automation files, but they are not the problem.

This is the command that I run:

arduino-cli compile -b arduino:avr:uno C:\Users\Cioccarelli\Desktop\transmitter\main

this is the error:

C:\Users\CIOCCA~1\AppData\Local\Temp\ccNp4ZLP.ltrans0.ltrans.o: In function `setup':
C:\Users\Cioccarelli\Desktop\transmitter\main/main.ino:9: undefined reference to `pin_init()'
collect2.exe: error: ld returned 1 exit status
Error during build: exit status 1

This is the main sketch:

#include "C:\Users\Cioccarelli\Desktop\transmitter\automation\automation.h"

void setup() {
    pin_init();
}

void loop() {}

This is automation.h:

#pragma once

// This is where the components input pins are stored, they are put here by the add_pin function
byte pinSetup[0];
byte pinSetupSize = 0;

/*
* Every time a component object is created, it's input pin is stored in pinSetup[], every pin
* in the array is then initialized as INPUT, this is used to make object creation esier
*/ 
void add_pin(const byte pin);

// This function is called in the setup() and it initializes every pin listed in pinSetup[] as input
void pin_init();

This is automation.cpp:

#include "C:\Users\Cioccarelli\Desktop\transmitter\automation\automation.h"

extern pinSetup;
extern pinSetupSize;

void add_pin(const byte pin) {
    if (pinSetupSize == 0) {
        pinSetup[0] = pin;
        pinSetupSize++;
    } else {
        pinSetup[pinSetupSize+1] = pin;
        pinSetupSize++;
    }
}

void pin_init() {
    for (int i = 0; i < pinSetupSize; i++)
        pinMode(i, INPUT);
}

I am not the best at C/C++, especially when it comes to the Arduino specific compiler, but I was able to get it to compile by including both the .h and .cpp files within the main.ino file and add the "byte" type to the extern declarations.

extern byte pinSetup[0];
extern byte pinSetupSize;

Hope this helps you move along a little further.

Even when you get it to work you will have issues because of this:

byte pinSetup[0];
byte pinSetupSize = 0;

The pinSetup array should be at declared as a length of at least 1. Also, multiple calls to add_pin will write past the end of the pinSetup array since you have no bounds checking.