Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implicit declaration of function - C99

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?

like image 641
Misa Avatar asked Jul 15 '11 08:07

Misa


People also ask

What does implicit declaration of function is invalid in C99 mean?

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.

What is an implicit declaration of function?

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.

What is implicit declaration of function warning in C?

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.

How do you fix implicit declaration of error?

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.


1 Answers

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.

like image 158
JPsnowytree Avatar answered Oct 05 '22 19:10

JPsnowytree