views:

952

answers:

1

log

warning: implicit declaration of function 'TutorialAlertWithMessageAndDelegate'

here my code

.h

void TutorialAlertWithMessageAndDelegate(NSString *title, NSString *message, id delegate);


.m
void TutorialAlertWithMessageAndDelegate(NSString *title, NSString *message, id delegate)
{
    /* open an alert with OK and Cancel buttons */
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title 
                                                    message:message
                                                   delegate:delegate 
                                          cancelButtonTitle:@"Dismiss"
                                          otherButtonTitles: @"Show Tutorial", @"Disable Tutorial", nil];
    // otherButtonTitles: @"Show Next Tip", @"Disable Tips", nil];
    [alert show];
    [alert release];
}
+1  A: 

That warning is generated when you try to call a function before declaring it. Your declaration in the header (.h) file seems to be correct, but you are probably not including that header file in the source file that is calling the function. Be sure to put:

#include "Tutorial.h" // replace with actual filename, of course

at the top of that source file.

benzado
thanks , i forget to include it but why it also work?
RAGOpoR
C doesn't require you to declare functions, although it's best practice to do so. That's why it only gave you a warning and not an error.
benzado
thank you benzado ^_^
RAGOpoR