Separate names with a comma.
Discussion in 'Mac Programming' started by andrewface, Jan 4, 2007.
whats a good c compiler for mac? i need it for my course...any suggestions
xcode do the trick?
Xcode has your back it is a fully functional and free C complier. If you are feeling a bit confident you can also use the terminal and gcc
cool where can i get xcode? or how do i install it i guess?
Xcode ships with every Mac and every copy of MacOS X. If it were not preinstalled on your computer, then it can be installed using the System Restore or Developer Tools disc. The latest version is a free download from the Apple Developer Connection website.
Yes Xcode is a very good compliler and comes on the cds you got with your mac.
before you turn in you homework you should compile and test it on whatever specification your prof sets out. if you projects get large enough, you end of losing dev to time to fixing the difference between compile rather than completing you project. for a newbie might be best to start on the system the your case is setup.
What's wrong with GCC?
If you are after a C compiler, use the developer tools, or better yet install GCC (GNU Compiler Collection).
considering xcode uses gcc...
Yeah, that should be fine for whatever you need for your course, as long as you keep in mind that not all gcc commands are supported in OS X, but you probably won't have any problems with that. I just use it with terminal instead of Xcode.
I agree, unless you need to write a cocoa or carbon app. If you need help on commands, just use the manual pages in the Terminal (man).
BTW, XCode isn't a compiler, it's an Integrated Development Environment. It uses GCC as the compiler as was stated earlier.
To use GCC in the terminal, just type:
gcc <c file name> -o <executable file name>
just like you would on any *n?x.
If you need to use make at all, that works too. So does gdb (XCode uses that for debugging).
my prof was talking about how C is universal and can work with many operating systems...can i write windows programs in xcode? i think ill most likely have to hand in windows apps (uhg ****ing windows)...
As long as your not creating visual elements (windows, dialog boxes, etc.) c-code is pretty generic and portable.
Talk to the professor and tell him your situation. I don't think they would force you to buy a windows PC just to compile.
He may want to run code on his own PC just to check though...
In fact a Windows PC should be the platform of last resort for a class on C. If I wasn't programming on my Mac, I'd be coding on somee flavor of Linux (and still be using gcc.) You could purchase a new Mac for what Microsoft will gouge you for some variety of .NET.
even simple programs that use simple file i/o between windows/dos and *nix which includes os x cause problems.
you are going to be doing a lot of #ifdef if you are writing coding on multiple platforms. i maintained code for about a year that was 10 years old. The first ver was written for a sun sparc then pushed over to bsd then windows then linux then a mac. yeah a lot of the code was the same but there are alot #ifdef to make code specific to PPC or x86 for example.
a good example if you try to use a library to print an IP address from x86 linux and get the code to compile on a PPC running OS X the ip address will print backwards due the little endian on a PPC.
I hadn't thought about that actually!
so if all i need is a c compiler should i bother installing the whole xcode package or should i just install gcc 4.0?
i dont need the whole 2.4 gigs installed i wont use any of it?
ok i installed the whole developers tools thing...when i first ran xcode it said new user...i exited the program...now it doesnt ask to set up new user...how do i set up a new user now?
If I recall from running Xcode the first time, it asks a bit about how you want the main window and the project window set and where you want to put binaries and things like that. It's not a big deal.
You should at least try the Xcode editor, even if you're going to compile on the command line. It saves me from starting emacs.
Only if the original programmer didn't know their stuff. Lookup "htonl" and "ntohl".
Was thinking the same thing but wouldn't say it.
We still push around 15+ year old c-code between platforms. Some of the stuff originated on VMS then to HP/UX or Sun and now to Linux. I love doing porting work. Getting old code that used to take an hour to do a task and having it run in like 4 minutes gives you a sense of accomplishment!
I dont think an intro course to C will require you to do Windows or any GUI-specific app.
Of course, I'm assuming its an introduction to programming in general and not just C, so probably you'll get only as far as using the stdin and stdout as your input/output.
If that's the case, you can write the programs in any environment you wish and it will work seamlessly.
BTW, did anyone else have to do their first programming course in college using scheme?