views:

111

answers:

2

i have a unix c programming assignment in which i do some advanced C network programming.this is my first step into advance programming. so i was wondering what is the best combination of tools for this on a mac. using an IDE like Eclipse is how i'd normally do it but i have to make my own makefiles and stuff. so i would like to learn how it can be done effectively using may be emacs or vim + other tools. it will be quite a big project so i am worried about project management and debugging issues mostly as well as the productivity factor. in essence i want to learn how programmers do it in the professional environment without the bloated IDE part. i am using Snow Leopard.i would also delve into C++ and python in the future so may be something that will be useful for those as well.

+4  A: 

XCode is your friend. It's free and is a very nice IDE. When you launch XCode, just start a new Console application (it'll be ANSI C).

Enjoy.

Justin Niessner
+3  A: 

I know you're asking for how to do it with makefiles/VI/etc. but on the Mac, Xocde is really the way to go, especially for large projects. It's a very effective wrapper that will call gcc and gdb and the linker for you. Especially when moving to a new platform, not having to worry with many of the pesky details will be a big leap in productivity. It's IDE debugger is quite awesome.

Of course you can also use makefiles etc. Many projects (just to take OpenSSL as an example) come with makefiles and you can compile them on the Mac from the commandline just like under the *ix operating systems, i.e. calling ./configure and then make. But setting up stuff like that (e.g. compiler options for universal binaries and such) is tedious while the IDE it's just a few options. Also, if you google for specific questions, you will find far more answers on how to do it with Xocde.

If you want to get started with Xcode, it's either on your Mac operating system CD (it just does not pre-install automatically) or you can download it from Apple. When you run it, just open a Mac OS X Project of type "Application - Commandline Tool" and you'll have a project with a main.c set up in a minute. You can then just run it or run it in the debugger like that and adding more source files to it is rather easy.

Xcode can be quite a beast for setting up an already large project (we ported a large project with DLLs and depending exes (overall 250000 lines of code) to the Mac and just getting that all set up wasn't what you call a piece of cake) but if you start from scratch you'll easily grow into it.

Bottom line is that Xcode certainly is equipped to deal with large projects and I can not imagine a more productive way of doing it (I have used hand written makefiles and such in the past so I know both worlds).

Nicholaz
yes i reckon xcode is the tool to use in a mac but my concern is wudn't it be better to learn a tool that i can use in a linux box as well in cases i may have to test it under linux. thats my only concern otherwise i wud definitely go for xcode.
sfactor
@sfactor: you're interested in learning OS X development, not Linux development, right? I'm sorry to say, but each new platform brings new challenges, and one of the (essentially) required challenges for developers moving to OS X is to learn XCode. Don't sell yourself short: just learn it, embrace it, and love it. You'll be very happy you did!
rpj
@sfactor: Well, as I said, the Unix way of doing things works on the Mac too. When you install Xcode you'll get gcc and friends installed which are required to compile/link from the command line. Another interesting point maybe. If you compile a program in Xcode (a sample program for example) you can have a look at how Xcode calls the compiler (in the Build pane you can watch all the tools running by and there is a button to see their details), so you can borrow the parameters for compiler and linker from there.
Nicholaz