"No previous prototype for function" warning
Solution 1:
According to c standard, declaring the prototype as
NSMutableArray* FBCreateNonRetainingArray(void);
// ---------------> ^^^^
// Yes, with the void as the parameter
solves the issue.
Solution 2:
To clarify Eric Dchao's answer above, someone at facebook apparently didn't put a "static" in front of that BOOL?
Anyways, changing from this
BOOL FBIsDeviceIPad() {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return YES;
}
#endif
return NO;
}
to this
static BOOL FBIsDeviceIPad() {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return YES;
}
#endif
return NO;
}
fixed it for me.
Solution 3:
UPDATE: Disable warnings is not a good solution, check @Derek Bredensteiner's answer.
In Xcode 4, go to your project's Build Settings. Search for "prototype". There should be an option called "Missing Function Prototypes"; disable it.
via here
Solution 4:
Is it a global function? Add "static" if it is only used in the current file.
The possible reason is as below:
no previous prototype for `foo'
This means that GCC found a global function definition without seeing a prototype for the function. If a function is used in more than one file, there should be a prototype for it in a header file somewhere. This keeps functions and their uses from getting out of sync
If the function is only used in this file, make it static to guarantee that it'll never be used outside this file and document that it's a local function