Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   Xcode help please =( (http://www.mac-forums.com/forums/os-x-development-darwin/87914-xcode-help-please.html)

polymerace 12-10-2007 03:09 PM

Xcode help please =(
 
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 12-11-2007 03:42 AM

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.

jdgti 12-11-2007 04:49 AM

Give me your required gcc tags and I can help you set it up.

jdgti 12-11-2007 05:27 AM

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.

DrQuincy 12-11-2007 05:30 AM

Excellent, that's just what I was looking for - thanks!


All times are GMT -4. The time now is 04:48 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.