objective c - Implicit declaration of function "..." is invalid in C99? -
i'm trying declare function within function. here's part of code: viewcontroller.m
- (void)updatedisplay{ [_displaytext settext:[nsstring stringwithformat:@"%d", counter]]; } - (ibaction)minus1:(id)sender { counter--; updatedisplay(); }
viewcontroller.h
- (ibaction)minus1:(id)sender; - (void)updatedisplay;
which returned me error of "implicit declaration of function "..." invalid in c99".
result: http://i.imgur.com/rsit6r2.png
i've found people have encountered similar problem, newbie didn't know next. help! :)
you not declaring function
; instance method
, call must send message self
;
[self updatedisplay];
edit
as @rmaddy pointed out (thanks that) declared instance method not class method. make things clear;
- (return_type)instance_method_name....
called via 'self' or pointer object instance.
+ (return_type)class_method_name....
called directly on class (static).
Comments
Post a Comment