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) Fundamentals of C Array

Ben Fischler
PLUS
Ben Fischler
Courses Plus Student 379 Points

I'm getting a Build Failed result from X-code, when my code is a match for what I'm seeing in the video demo.

X-code has started giving me a Build Failed result for my code (both array and the printf code and I'm currently baffled why and or what changed...

In the X-code error log I see this:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

...so I think this is something X-code is hung up on.

Here's the code:


include <stdio.h>

int main() {

float numbers_geeks_love[3];
numbers_geeks_love[0] = 3.1415;
numbers_geeks_love[1] = 1.6180;
numbers_geeks_love[2] = 1.4142;

printf("PI %f\n", numbers_geeks_love[0]);
printf("golden ratio %f\n", numbers_geeks_love[1]);

return 0;

}


This also fails:

include <stdio.h>

int main() {

int days_in_a_week = 7;
float cm_to_in = 2.54;

char the_w;
the_w = 'W';


// insert code here...
printf("%days in a week.\n", days_in_a_week);
printf("%f cm per in.\n", cm_to_in);
printf("The %c is a cool hotel.\n", the_w);

return 0;

}

Kevin Hamil
Kevin Hamil
8,203 Points

Errors can mean various things in various situations. It's difficult to help without seeing the code to figure out and understand what's causing the error. Anytime you ask for help like this it's best practice to post the code in question.

Having said that, I would suggest you edit your question to include your code. Also, it's a good idea to download the project files and compare your code with with official project code you download. Many times it can be something as simple as a non-capitalized letter, or something like that easily overlooked.

2 Answers

Ben Fischler
PLUS
Ben Fischler
Courses Plus Student 379 Points

Thanks, I edited the original post. The odd thing is that the basic printf code is broken too... So it feels like X-code is somehow borked.

Try to use 'stop' (the square button next to the 'play/build') and then try to 'play/build' it again. Sometime it happens to me and I use this method and it works. :)