You are here

Warning on static function | Cypress Semiconductor

Warning on static function

Summary: 4 Replies, Latest post by DavideCypress on 05 Feb 2015 03:06 AM PST
Verified Answers: 0
Last post
Log in to post new comments.
DavideCypress's picture
11 posts

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 ?


user_1377889's picture
9249 posts

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.


yfs's picture
Cypress Employee
102 posts

Are you sure you did not include the header in more than one source file?

-- Mark.


Aussie Susan's picture
42 posts

 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.


DavideCypress's picture
11 posts

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 I'll declare my static function only in the source file. Thank you very much for all ;)

Log in to post new comments.