Mobile App Development

Eclipsing Xcode for Mac Development

May 16, 2008

  • Nate Petersen

Apple has a (well-earned) reputation for creating products that are simply a pleasure to use. The iPhone springs to mind as a crowning achievement in this regard. But man, do I ever hate Xcode.

Nothing is where I expect it to be. I can’t seem to close a window I don’t want without closing the whole project. When I try to debug an application, I can’t get the present value of variables in all levels of the stack trace.

I’m willing to consider the possibility that it works great, and I’m just doing it wrong. Maybe it’s just the inertia of being comfortable with my current IDE. But in any event, when I found myself needing to write and compile a C application using OSX libraries, I let out a bit of a groan.

Imagine my relief when I finally figured out how make Eclipse see the OSX libraries. All you have to do is add an entry to Project Properties-> C/C++ Build-> Settings-> Tool Settings-> MacOS X C Linker-> Miscellaneous-> Linker flags. For each framework you want to use, just add:

-framework framework_name

For instance, after adding:

-framework QuickTime

I was able to use the Quicktime libraries by adding the appropriate import to my files:

#include <QuickTime/QuickTimeComponents.h>

Easy, right? I would add the caveat that I have not yet done any GUI development using the native OSX libraries, so YMMV. Xcode may still be your best choice when making interfaces using Cocoa and Quartz. But if you just want to write C/C++ applications to unleash your Mac’s inner Unix, Eclipse is hard to beat.