mparrish91 mparrish91 - 2 months ago 17
Objective-C Question

LinkedList Objective C - Implicit declaration of function invalid in c99

referencing this post - link

I have my function declared in my header file, however the error -"Implicit declaration of function invalid in c99" still shows. I am not sure however if that is ultimately what is causing my final error which is "ld: symbol(s) not found for architecture x86_64"

I tried changing the architecture in build settings to 386, without luck.

enter image description here

enter image description here

Tim Tim
Answer

Calling an Objective-C method looks different than calling a C function. In this instance, you've written a method -printKthToLast:withHead:, and you'll need to call it on an object like so:

int index = [self printKthToLast:k withHead:head.next] + 1;

Note the use of square brackets around the entire method call; the receiver, in this case self; the individual argument labels; and the lack of parentheses.