Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 23, 2005, 12:10 PM   #1
bacon7
macrumors newbie
 
Join Date: Nov 2005
Question about using C in xcode

Hi, i am not a developer at all, but have been running some numerical models that were written in C by my graduate advisor.

In the past, I have compiled (gcc) on a unix machine with no problems. Using the Xcode interface, I can't get it to read in a ascii file, so the program will not run. Also, i typically run the malloc.h header file, but since it isn't included with mac (i think), it seems that the stlib.h has everyhting that malloc.h has. Basically, my question is how to set up the xcode interace so that I can read in my input files. Like i said, i am not a developer, so i appologize if I sound silly with some of this.

thanks
mike
bacon7 is offline   0 Reply With Quote
Old Nov 23, 2005, 01:25 PM   #2
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
You probably are reading in the file with a bad path. We can't do much unless you post code and give a more specific example really...

BTW, if you're not a developer, why use Xcode? For plain ol' C/C++ console apps GCC/Terminal is easier.
kainjow is offline   0 Reply With Quote
Old Nov 23, 2005, 05:42 PM   #3
Jordan72
macrumors member
 
Join Date: Nov 2005
In Xcode:

1. Start up Xcode.

2. From the File menu, select New Project.

A window named Assistant will appear.

3. Under the Command Line Utility section pick select Standard Tool, then press the next button.

4. Name your project and press the Finish button.

5. Find the file main.c and double click on it.

6. Now, paste your code in here. (If you have multiple files, you'll have to do something else, just let me know.)

7. Under the Build menu, select Build. This will compile your code.

If you have any errors, just let me know. I may be able to help out more.

In Terminal:

1. Start the Terminal program located on your Mac.

2. Make sure you are in the directory where you c file exists for this explanation.

3. Your file should have a .c extension. I.e., myCodeToBeCompiled.c

4. Type in gcc yourCode.c -o "myExecutable"

5. Let me know if you get any errors.

6. If not, now type ./myExecutable

This will make your program run.
Jordan72 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Newbie question about Xcode 4 Apple2 iPhone/iPad Programming 2 Apr 16, 2011 05:03 PM
Really remedial question about saving programs in xcode eacron Mac Programming 7 Dec 16, 2010 12:33 PM
Question about using logos in my app: guydor iPhone/iPad Programming 2 Jan 23, 2010 06:36 AM
Question about using software update in macbook kaiPhone19 MacBook 4 Nov 17, 2008 07:10 AM
Question about using HTML symbols in an HTML email macaddict23 Web Design and Development 3 Jul 9, 2008 05:50 PM


All times are GMT -5. The time now is 05:47 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC