Simplest Instructions for Compiling

Joined
Jan 21, 2009
Messages
9
Reaction score
0
Points
1
Location
Midland, Michigan
Your Mac's Specs
MB Pro, 17", 2.5 GHz Intel
Hi. I am looking for the simplest instructions to compile an executable either using Xcode or from the terminal. I downloaded a sample C program and I want to compile and test it. I don't know where to put the header file that it needs (what directory to put it in) or how to tell gcc where to look (from the Terminal). If I could figure out how to compile in Xcode, that would be cool, because I assume I could get away from typing long path names and stuff.

I imagine this question has been answered in another thread, but I couldn't find it. I will be happy if you can direct me to such a thread, or post the answer here.

Thanks.
 
Joined
Jan 6, 2008
Messages
9
Reaction score
1
Points
3
Easiest way in XCode would be to create a new C application, then import all your files into your new project. As far as the proper location of the header files and what not, just have a look at includes at the top of the .c files, but usually they'll be in the same directory as your main.c and all your other files (especially for a small/simple application)

If you'd rather use g++ instead and plan to modify that application, you might want to look into makefiles
 
OP
MichiganDavid
Joined
Jan 21, 2009
Messages
9
Reaction score
0
Points
1
Location
Midland, Michigan
Your Mac's Specs
MB Pro, 17", 2.5 GHz Intel
Thanks, I'm getting there

Easiest way in XCode would be to create a new C application, then import all your files into your new project. As far as the proper location of the header files and what not, just have a look at includes at the top of the .c files, but usually they'll be in the same directory as your main.c and all your other files (especially for a small/simple application)

If you'd rather use g++ instead and plan to modify that application, you might want to look into makefiles

Thanks for your advice. I have had some success, but I'm having a different problem that I will describe in a new thread.

David
 

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