PDA

View Full Version : im taking a c programming intro course...need a c compiler




andrewface
Jan 4, 2007, 09:23 PM
whats a good c compiler for mac? i need it for my course...any suggestions

xcode do the trick?



Kodex
Jan 4, 2007, 09:24 PM
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

andrewface
Jan 4, 2007, 10:01 PM
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?

MisterMe
Jan 4, 2007, 10:11 PM
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 (http://developer.apple.com/) website.

fivetoadsloth
Jan 4, 2007, 10:51 PM
Yes Xcode is a very good compliler and comes on the cds you got with your mac.

superbovine
Jan 4, 2007, 11:42 PM
whats a good c compiler for mac? i need it for my course...any suggestions

xcode do the trick?

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.

iancapable
Jan 5, 2007, 12:09 AM
whats a good c compiler for mac? i need it for my course...any suggestions

xcode do the trick?

What's wrong with GCC?

If you are after a C compiler, use the developer tools, or better yet install GCC (GNU Compiler Collection).

Srsly :)

superbovine
Jan 5, 2007, 12:17 AM
What's wrong with GCC?

If you are after a C compiler, use the developer tools, or better yet install GCC (GNU Compiler Collection).

Srsly :)

considering xcode uses gcc...

MacFan26
Jan 5, 2007, 02:16 AM
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.

hopejr
Jan 5, 2007, 02:47 AM
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).

andrewface
Jan 5, 2007, 07:44 AM
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)...

pilotError
Jan 5, 2007, 08:44 AM
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...

Mike...

Swarmlord
Jan 5, 2007, 08:52 AM
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...

Mike...

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.

superbovine
Jan 5, 2007, 09:19 PM
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)...


lol!

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.

iancapable
Jan 8, 2007, 12:06 AM
considering xcode uses gcc...

I hadn't thought about that actually!

andrewface
Jan 8, 2007, 10:44 PM
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?

andrewface
Jan 8, 2007, 10:55 PM
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?

bousozoku
Jan 8, 2007, 11:30 PM
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.

gnasher729
Jan 9, 2007, 04:37 AM
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.

Only if the original programmer didn't know their stuff. Lookup "htonl" and "ntohl".

pilotError
Jan 9, 2007, 07:41 AM
Only if the original programmer didn't know their stuff. Lookup "htonl" and "ntohl".

LOL...

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!

colocolo
Jan 9, 2007, 08:07 AM
Andrew,

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? :p