Hi Aaron:On Feb 16, 2006, at 5:48 AM, Aaron koolen wrote: Hi all. New to XCode and Mac programming as a whole, and after struggling with XCode tonight for a few hours, I'm going insane so thought I'd ask. Bare with me as I have a few questions...
Welcome to Mac programming! Please try to be careful to use a real subject next time. Also - beware that because you didn't specify an environment, we're going to assume you're running the latest Xcode (2.2+). I'm starting to develop an application that has:
1) The main App (Duh) - lets call it App 2) Dynamic libraries that this main app loads (Maybe 5-6 of them) 3) Static libraries that the Dynamic libraries use (String manipulation, core file functions etc etc etc - could be half a dozen of those too by the end)
Now coming from the Windows Visual C world, I first thought I'd be better off making a project for each of these things and then somehow linking them together so that when I build App, it builds the others as well. Well this just didn't work. If I changed a source file in the statlib project, it wouldn't compile the dynamic lib or App.
Question one is - Can it be done this way, and is it the best way to do a project like this? Question two - is there any sort of 'Solution' concept in XCode like there is in Visual C? Yes it can be done this way. I don't know what solutions are entirely but it sounds like what you're getting at is that Visual C lets you have "uber-projects" that contain other projects. I think the difference with Xcode is that any project can behave in this fashion - you just have to add other projects to it.
You can find a lot of information in the Xcode documentation, but for starters, just know that if you add a *project file* to another project, it is treated magically. The project file in the groups and files hierarchy can be expanded to show off all the targets that can be built by it. You use these magic target proxies to *add* to another project. For instance, if a project builds "MyLib.a", then you select the target for your main app, and then click the checkbox next to the "MyLib.a" after adding the sub-project.
You also want to set up the sub-project as a dependency. This won't happen automatically. Do a Get Info on the main application "target" item, where you'll see a big, blank, easy to ignore list of dependencies. Click the + sign at the lower-left corner and it should bring up a list of possible dependencies, including any projects you've added to the "uber-project.
Then I was reading through the docs and it seemed to suggest that a better way is to have one project for the entire thing, and make targets for the dynamic lib, and static lib. So I fiddled with this, made targets, made dynamic lib depend on static lib, and App depend on dynamic lib, so that a change in one would build the others.
Historically Xcode wasn't as good about this stuff, so there was more of an argument for doing everything in one massive project. Things have since gotten better, though there are some caveats to using the "projects within projects" method. For instance searching the entire project sources won't turn up results in the dependency projects.
Question three - Is there a way, and how do I do it?
You really only had one question - but boy did you manage to stretch it out :)
Daniel
|