11

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
  • 1
    I'd need the code that generates that warning, not the code that defines the function: that is where the issue lies.
    – Grant Paul
    Feb 13, 2010 at 5:14

1 Answer 1

12

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.

1
  • 5
    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
    Feb 13, 2010 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.