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

Rafael Sanchez
Rafael Sanchez
11,804 Points

Error: Linker command failed with exit code 1

ok so I have done all the steps on the array video but when i go to print it says fail ( Linker command failed with exit code1(use-v to see invocation) any ideas.

Try posting your code.

7 Answers

Rafael Sanchez
Rafael Sanchez
11,804 Points

// // main.c // MyFirstCProgram // // Created by turner on 9/26/13. // Copyright (c) 2013 treehouse. All rights reserved. //

include <stdio.h>

int main() {

float numbers_geeks_love[] = {3.1415, 1.6180, 1.4142};


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

int primes[] = {2, 3, 5, 7};
printf("the first 4 prime numbers %d %d %d %d\n", primes[0], primes[1], primes[2], primes[3]);
return 0;

}

it's not showing up completely in your code but do you have:

#include <stdio.h>
Rafael Sanchez
Rafael Sanchez
11,804 Points

include <stdio.h>

int main() {

float numbers_geeks_love[] = {3.1415, 1.6180, 1.4142};


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

int primes[] = {2, 3, 5, 7};
printf("the first 4 prime numbers %d %d %d %d\n", primes[0], primes[1], primes[2], primes[3]);
return 0;

}

Nothing is standing out right now as an error in the program.

Were you able to successfully compile and run a program before this one?

Rafeal it looks like you are missing a small part of the #include

Here is what the code should look like.

//
//  main.c
//  MyFirstCProgram
//  Created by turner on 9/26/13.
//  Copyright (c) 2013 treehouse. All rights reserved.
//
#include <stdio.h> //add this <stdio.h>

int main()
{

    float numbers_geeks_love[ ] = {3.1415, 1.6180, 1.4142};

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

    int primes[] = {2, 3, 5, 7};
    printf("the first 4 prime numbers %d %d %d %d\n", primes[0], primes[1], primes[2], primes[3]);
    return 0;
}
Rafael Sanchez
Rafael Sanchez
11,804 Points

Jason- no it just says build failed Aaron- the code looks like the one I have on my layout.

Delete it and start a new project.