Hi at all,
I'm working with PSoC Creator and I have a little problem; in my header file I have declared a static function that I have defined and used in the relative source file, but when I compile the code, appears this warning
'sht1x_writeByte' declared 'static' but never defined [-Wunused-function]
I really dont' know where is the problem because the function is defined and used...please, could anyone tell me what's wrong ?
Welcome in the forum!
Sounds a bit like a typo, but that's a guess. Best will be to post your complete project. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Why are you placing a static function declaraction into a header?
Typically a header is used by multiple source files so they know that there is a suitably named function that they can use. (Often they have an 'extern' part of their declaration as well.)
However 'static' tells the C compiler that this funciton is not visible outside the source file.
Therefore, if you are using the header in a source file that does NOT define the function, then the compiler will complain.
First of all, thank you for welcome; I read all your posts and I find the last very interesting, in fact I did not realize this issue...now I'll declare my static function only in the source file. Thank you very much for all 😉