in my avrstudio4 project i've got this error:
../Indication.c:95:15: error: static declaration of 'menu_boot' follows non-static declaration
in main.c i type #include "indication.h"
indication.h is a header file for indication.c and function is defined in it like this:
unsigned char menu_boot(unsigned char index, unsigned char *menu1)
__attribute__((section(".core")));
in indication.c i've got
#include "indication.h"
...
unsigned char menu_boot(unsigned char index, unsigned char *menu1)
What should i do?
Taken at face value, the error message means that at line 95 of file ../Indication.c (which may or may not be the same file as the file named indication.c that you discuss), there is a static declaration for menu_boot such as:
static unsigned char menu_boot(unsigned char index, unsigned char *menu1);
or a static definition of it, such as:
static unsigned char menu_boot(unsigned char index, unsigned char *menu1)
{
...
}
Consider the following code in a file xx.c:
extern unsigned char function(int abc);
static unsigned char function(int abc);
static unsigned char function(int abc)
{
return abc & 0xFF;
}
When compiled with GCC 4.1.2 (on RHEL 5), the compiler says:
$ gcc -c xx.c
xx.c:3: error: static declaration of ‘function’ follows non-static declaration
xx.c:1: error: previous declaration of ‘function’ was here
$
If I comment out line three, then the compiler says:
$ gcc -c xx.c
xx.c:6: error: static declaration of ‘function’ follows non-static declaration
xx.c:1: error: previous declaration of ‘function’ was here
$
The message is the same, but includes the information about where the previous declaration was. In this case, it is in the same source file; if the declaration was in a different source file (typically, a header) included in the translation unit, then it would identify that other file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With