Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Objective-C Basics (Retired) Pointers and Memory Structs

Mike Lange
Mike Lange
794 Points

Following this tutorial I receive errors in xCode 6 - Implicit declaration of function makeSphere invalid

To resolve this issue (after googling the error) I found the suggestion to move the function definition above the MAIN function. This resolved the issue and the program runs, but it leaves me confused as to why it was necessary (when in the video tutorial the makeSphere function was defined below MAIN).

ie. The following code segment was moved to the top of the file:

Sphere makeSphere (float *c, float r) {

Sphere sphere;
sphere.center [0] = c[0];
sphere.center [1] = c[1];
sphere.center [2] = c[2];

sphere.radius = r;

return sphere;
}

Note: Before you ask - yes, the function was already declared prior to MAIN:

Sphere makesphere (float *c, float r);

2 Answers

Chema Castellanos
Chema Castellanos
3,984 Points

it depends, it could be you settings on the xCode or an implementation error, could you copy the code that is generating the error?

michael finney
michael finney
229 Points

i still am getting an error when I am exactly like the tuturial shows. I don't understand where to place the code that you are talking about above, can you help?

UPDATE: I got it, not sure what was wrong at first, but I got it.