misadventures of an xcode idiot

17 Oct

More proof that life is hard. This post details some of the mistakes you might make trying to use xcode as a complete beginner (to xcode and macs in general!)

I decided to use libxml for XML-parsing on an iphone app, since it comes in the dev environment by default and doesn’t require you to use an event-based parsing method. Tutorials say that you must link to the library, and set up your include paths to find the proper headers. Standard stuff, so let’s get started!

I can see the libraries my project is already linking to in the document view of xcode, so logically I’ll just right-click there and add a new one. I don’t see anything to add libraries to link to specifically, so perhaps “add files” will simply infer from the type…

First, I don’t know where this file is. Other tutorials will tell you it’s found in /Developer/Platforms/iPhoneOS.platform/... There’s no /Developer on my machine. Maybe it exists on “real” macs or maybe the first part of the path is so obvious everyone omits it. So find it the old fashioned way:

What I’m looking for seems to be in /Applications/Xcode.app. Let’s add it.

Hm. No subfolders in /Applications in this finder-ish window, just icons. Well, maybe they are really subfolders and they just have icons? Double-click xcode to find out.

Bad idea! This “adds” the xcode application itself to my project somehow, and whatever it does causes the running instance to hang for several minutes. Kill the xcode process in terminal, and try to re-load it? Hangs on startup. Don’t be like me. Luckily I was able to revert the project file using source control.

So for this to be of use to anyone, I should describe the non-stupid way to do this:

Click the project itself in your xcode document list, go to “build phases”, and add to link with binaries.

This automatically navigates to the right directory and gives you a handy search bar, which you can use to find libxml.

Then go to the “Build Settings” tab, be sure to select “All” settings instead of “Basic”, and update your include paths. (/usr/include also didn’t exist on my machine but it finds the right place anyway).

After this configuration, you can return to the easy, relaxing task of coding. Good night.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: