Error: ld returned 1 exit status

Hello, I want to implant a code to measure the current, but I have an error and I don’t know what causes it. If anyone could help me I would be very grateful.
The error message is as follows:

C:\Users\AUDITO~1\AppData\Local\Temp\ccAKTzMz.ltrans0.ltrans.o: In function `main’:

ccAKTzMz.ltrans0.o:(.text.startup+0x130): undefined reference to `loop’

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compilación en tarjeta Arduino/Genuino Uno.

And the code:

unsigned long sampleI;
unsigned long lastSampleI;
double filteredI;
double lastFilteredI;
double sqI;
double sumI=0;
int ADC_COUNTS=1024;
double Irms;

void setup()
{
Serial.begin(9600);

pinMode(A0, INPUT);
}

double calcIrms(int NUMBER_OF_SAMPLES){
int SUPPLYVOLTAGE=3300;
int ICAL = 90.9;

for (int n = 0; n < NUMBER_OF_SAMPLES; n++){
lastSampleI = sampleI;
sampleI = analogRead(A0);
lastFilteredI = filteredI;
filteredI=0.996*(lastFilteredI+sampleI-lastSampleI);
sqI = filteredI * filteredI;
sumI += sqI;
}
Serial.println("");
Serial.print("A0 → ");
Serial.println(sampleI);
double I_RATIO = ICAL *((SUPPLYVOLTAGE/1000.0) / (ADC_COUNTS));
Irms = I_RATIO * sqrt(sumI / NUMBER_OF_SAMPLES);
sumI = 0;
Serial.print("Irms → ");
Serial.println(Irms);
return Irms;
}

Codigo_intensidad_2.ino (835 Bytes)

Is there some part of "You must have a loop() function" that you don't understand?

thanks, i'm very beginner on this.

PaulS:
Is there some part of "You must have a loop() function" that you don't understand?

Hacker05:
...

And? Is this a question? Or a comment to solve this old thread?