Hi,
Lets say I have a "super special" function written in C that I want static. I'm using gcc (or avr-gcc to be more precise). Here is the "super special" code:
head.h
source.c
Here is what avr-gcc gives me with all it's wisdom:
head.h:12: warning : 'display_A' declared 'static' but never defined
It shows this warning for all my static functions. If I compile a second time, avr-gcc doesn't bring up those warnings again. My question is: Why? And what am I doing wrong? My supposition is that when reading the first time the files, the compiler doesn't know about the static functions, but finds them after and create the objects file. The second time the linker did it's job so the compiler knows where the static function is declared. Am I right?
Lets say I have a "super special" function written in C that I want static. I'm using gcc (or avr-gcc to be more precise). Here is the "super special" code:
head.h
Rich (BB code):
static void display_A(void);
Rich (BB code):
#include "head.h"
static void display_A(void){
//instructions...
}
head.h:12: warning : 'display_A' declared 'static' but never defined
It shows this warning for all my static functions. If I compile a second time, avr-gcc doesn't bring up those warnings again. My question is: Why? And what am I doing wrong? My supposition is that when reading the first time the files, the compiler doesn't know about the static functions, but finds them after and create the objects file. The second time the linker did it's job so the compiler knows where the static function is declared. Am I right?