function declared static but never defined function declared static but never defined c c

function declared static but never defined


A static function can be declared in a header file, but this would cause each source file that included the header file to have its own private copy of the function, which is probably not what was intended.

Are u sure u haven't included the abc.h file in any other .c files?

Because declaring a function as static, requires the function to be defined in all .c file(s) in which it is included.


Good practice: Declare static functions in the source file they are defined in (please also provide prototype), since that's the only file they are visible in.

This way, the function is only visible to that file, such visibility issues can reduce possible code conflict! So, just provide the prototype and the static function definition in the .c file. Do not include the static function in the header file; the .h file is for external consumption.

Duplicate: Static functions in C