如何解决警告的功能隐式声明的目标C
问题描述:
warning: implicit declaration of function 'TutorialAlertWithMessageAndDelegate'
这里我的代码
.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];
}
答
时产生警告,当您尝试声明之前调用的函数。您在头文件(.h)文件中的声明似乎是正确的,但是您可能没有在调用该函数的源文件中包含该头文件。请务必在该源文件的顶部放置:
#include "Tutorial.h" // replace with actual filename, of course
。
我需要生成该警告的代码,而不是定义函数的代码:问题出在哪里。 – 2010-02-13 05:14:13