I am getting the following error #error cpstm8 main.c missing prototype, but what I do not understand is the reason that I am receiving it, I declared the prototype of my function on the top and this error still keep happening, maybe I am missing something, the code follows below.
In my code, I want to gather the data coming from USB, save it in a variable for processing it later.
int * UART1_ReceiveBytes();
void main(void)
{
while (TRUE)
{
int * p;
p = UART1_ReceiveBytes();
}
}
int * UART1_ReceiveBytes()
{
int i = 0;
int buf [3] = {0x30, 0x30, 0x30};
if (UART1_GetFlagStatus(UART1_FLAG_RXNE) != RESET)
{
do
{
buf[i] = UART1_ReceiveData8();
i++;
delay_ms(10);
}while(i != 3);
UART1_ClearFlag(UART1_FLAG_RXNE);
}
return buf;
}
I am using COSMIC as a compiler since I am programming STM8 I follow the solution that @Eraklon gave (int * UART1_ReceiveBytes(void);) This solved the problem.
I would like to know if declaring void is just about the compiler or there is some specific rule? Most examples that I was looking declared the prototype like this (int * UART1_ReceiveBytes();)