tags:

views:

6078

answers:

4

Hi all, I'm an experienced VS.NET user and trying to get up and running on XCode 3.1.1.
Here's what I'm trying to accomplish:

I'd like a static library ("Lib") to have its own xcodeproj file. I'd an executable application ("App") that makes use of Lib to reference Lib's xcodeproj file so that changes to Lib cause App to relink. Ideally, I'd like to be able to edit Lib's source files inside App's xcode workspace so I don't have to task around all the time to make changes.

I figured out from the online help that I can simply drag the static lib xcodeproj in to my app's project and it gets the reference. I see that once my static lib xcodeproj is in my app's project, I can simply drag it to the App's target and it understands that App depends on Lib. This seems like the right path, but things aren't quite working the way I'd like yet.

Here are my questions:

  1. It seems that simply having App depend on Lib doesn't cause App to link with Lib. It seems that I have to explicitly drag libLib.a from the Lib folder into App's "Link Binary With Libraries" build stage. In VS.NET, simply specifying the project as a solution dependency adds it to the link line. I just want to make sure I'm not missing anything.

  2. When I have App open in XCode and I drag Lib.xcodeproj into it, I don't get any of Lib's source files there. I only get libLib.a under the "Lib.xcodeproj" folder. In VS.NET, I can edit Lib's source files right there and rebuild it, etc... but with this approach in XCode, changes to Lib.cpp don't cause Lib to rebuild when I rebuild App. Ideally, I'd get all of Lib's source files and targets to show up when I drag Lib.xcodeproj into App. Is there any way of doing this?

Thanks in advance for any responses!

+4  A: 
que que
A: 

I am also a fairly new user of Xcode. Most of what I know I learned from an Xcode book by James Bucanek (ISBN 047175479x). It is an older book that was written for/with Xcode 2.2, but I find that pretty much all of it still applies for me today, and I currently use Xcode 3.1

You can probably find a cheap used copy if you are interested. I only really used about half of the chapters (with the other half being either too basic, too obvious, or too Cocoa oriented). But even just the small subset of chapters that I actually used were worth the (cheap) used-book price that I paid.

que que
+4  A: 

You're correct that making target A depend upon target B (whether within the same project or across projects) does not cause target A to link against target B. You need to specify them distinctly; this is because they're separate concepts, and you might have dependencies between targets that you don't want to link to each other — for example, a command-line tool that gets built by target C and is used as part of the build process for target A.

Also, you're correct that referencing project B from within project A will not let you see project B's source code in project A's window. That's because Xcode does not have the same "workspace" model that Visual Studio and Eclipse do; you above alluded to the existence of "a workspace containing project A" but Xcode doesn't really have any such thing, just a window representing project A.

Chris Hanson
Hey Chris, thanks a lot for the short but detailed answer. I appreciate it!
Charles Nicholson
A: 

Hi,

I'm also novice to XCode 3.1, just played with mentioned by you issues and found that there is no problem regarding to your second question. Whatever application you use to edit the dependence library source code, your main project will rebuild the dependence target. I checked it by: 1. edited the source file, of the library your app depend on, by notepad application. 2. Selected dependence library project reference, mouse right-click, and select 'Open With Finder', then selected wanted source file and edited it. Everything working well.

Alex