Xcode help please =(

Joined
Dec 10, 2007
Messages
1
Reaction score
0
Points
1
I'm having a lot of problems with Xcode. Well, thing is, I'm taking an introductory C course and I wrote the sample code that is given in the book just to see the ouput. I write the code, right? Then I click Build. It always says that the build has failed. I know the code is supposed to work because it is from the book and the output should be such. If someone could walk me through compiling a C code in Xcode, that would be awesome and I'd really really appreciate it. Thanks again!
 

Del


Joined
Dec 24, 2006
Messages
901
Reaction score
15
Points
18
Location
N. Ireland
Your Mac's Specs
Mac Pro 2xQuad core 2.8GHZ
I have never used xcode - BUT if people here are to give help on your code it would be a good idea to post your code in the message so that they/we can examine it for errors.

Also if this forum has code tags (dont know havent checked) then use them around the c source code so that it gets nicely formatted in your forum message.
 
Joined
Mar 14, 2005
Messages
443
Reaction score
3
Points
18
Location
Atlanta, GA
Your Mac's Specs
17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
Give me your required gcc tags and I can help you set it up.
 
Joined
Mar 14, 2005
Messages
443
Reaction score
3
Points
18
Location
Atlanta, GA
Your Mac's Specs
17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
Actually, no one has explained this on these forums for a while so I am going to help by posting a quick tutorial just for reference.

To compile a plain C file:

1. Open Xcode
2. Go to "File" and choose "New Project"
3. A window will pop up (Project Assistant Window), Scroll down a little and then expand the "Command Line Utility" set.
4. Select the "Standard Tool" (This is the Xcode's Standard C representation)
5. Name your project, Click Next
6. Go to the left side of the window under "Groups & Files" and expand the Source set.
7. There you will find something familiar, a "main.c" file. Click the "Editor" button at the very top of the window next to the circular "Info" button.
8. The C code you want to edit is on your right now.

... Edit code ...

To Compile:
1. Click the "Build and Go" button at the top of the window. (Any errors should show up in red)

To see your program in action:
1. Go to the left again under "Groups & Files"
2. Expand the "Products" set.
3. Double click on the name of your project. And as Mr. Jobs says "Boom!" And there's your program.

To Add gcc Tags:
1. Go to the left again under "Groups & Files"
2. Expand the "Targets" set
3. Right click on the name of your project.
4. Select "Get Info"
5. Click the "Build" tab at the top.
6. Scroll all the way down to the bottom.
7. Under "GCC 4.0 Warnings" click "Other Warning Flags"
8. Type in your class required flags probably something like "-ansi -pedantic -Wall" etc.

Feel free to PM me if you want one on one help.

Let us know how it turns out.

Good Luck.
 
Joined
Nov 10, 2006
Messages
324
Reaction score
6
Points
18
Location
Leeds, England
Your Mac's Specs
17" Core Duo Macbook Pro
Excellent, that's just what I was looking for - thanks!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top