I am currently using Xcode 4, and in my .pch file I have this macro: #define localize(s) NSLocalizedString((s), nil)
.
When I try to use this macro in some .m file, I receive this warning: Implicit declaration of function 'localize' is invalid in C99
.
This code compiles without a problem, but how can I fix this so I don't get a warning?
implicit declaration of function means you do not have Prototypes for your functions. You should have a Prototype before the function is used. "call the block" I assume your Blocks are functions. 10/1/2020.
If a name appears in a program and is not explicitly declared, it is implicitly declared. The scope of an implicit declaration is determined as if the name were declared in a DECLARE statement immediately following the PROCEDURE statement of the external procedure in which the name is used.
Implicit declaration of functions is not allowed; every function must be explicitly declared before it can be called. In C90, if a function is called without an explicit prototype, the compiler provides an implicit declaration.
Function name typo: Often the function name of the declaration does not exactly match the function name that is being called. For example, startBenchmark() is declared while StartBenchmark() is being called. I recommend to fix this by copy-&-pasting the function name from the declaration to wherever you call it.
I had this problem when I did a global replace of NSLog with DLog. I foolishly included the
#define DLog(...) NSLog(...
statements, so I ended up with
#define DLog(...) DLog(...
which caused the warnings, and a linker error.
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