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 trialRafael Sanchez
11,804 PointsError: 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.
7 Answers
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;
}
Jason Anello
Courses Plus Student 94,610 Pointsit's not showing up completely in your code but do you have:
#include <stdio.h>
Rafael Sanchez
11,804 Pointsinclude <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
11,804 Pointsyes i do
Jason Anello
Courses Plus Student 94,610 PointsNothing is standing out right now as an error in the program.
Were you able to successfully compile and run a program before this one?
agreatdaytocode
24,757 PointsRafeal 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
11,804 PointsJason- no it just says build failed Aaron- the code looks like the one I have on my layout.
agreatdaytocode
24,757 PointsDelete it and start a new project.
Rafael Sanchez
11,804 Pointsok thank you i will do so.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsTry posting your code.