Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

XCode 3 static library dependency linking

 
   Soft32 Home -> Mac -> Programmer Help RSS
Next:  Using notifications with a sheet?  
Author Message
Corvus13

External


Since: Nov 07, 2007
Posts: 1



(Msg. 1) Posted: Wed Nov 07, 2007 1:21 am
Post subject: XCode 3 static library dependency linking
Archived from groups: comp>sys>mac>programmer>help (more info?)

Hi,

I wonder if someone might shed some light on the way dependencies work
in XCode 3. I've found that I can drop either a statically compiled
library file itself into the External Frameworks group of an
application project and it links correctly. However this does not
allow it to be specified as a direct dependecy when editing the Target
application. Dropping the xcodeproj itself into the External does
allow for this direct dependency and once added goes as far as even
specifying the library path amongst the search paths for the linker.
However, the actual library file is not actually linked to the
application despite being properly compiled upon compiling the main
application.

I seem to be able to work around this problem by dropping both the
compiled lib file and the xcodeproj into the External Frameworks but
this seems like such a bizarre solution to me especially since opening
the added xcode project reveals the same .a file reference inside it.


Anyone know how this should be done properly?

Thanks
Back to top
Login to vote
Ben Artin

External


Since: Oct 05, 2005
Posts: 225



(Msg. 2) Posted: Wed Nov 07, 2007 9:08 am
Post subject: Re: XCode 3 static library dependency linking [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Corvus13 wrote:

> I wonder if someone might shed some light on the way dependencies work
> in XCode 3.

It's very simple.

If you add project A to project B then targets in B can depend on targets in A.

If you make target A1 a dependency of target B1 (which you can do in target
inspector for B1), then building B1 will also build A1.

If you want B1 to link against the product of A1, then you need to add the
product of A1 to B1, just like you would with any other library you want B1 to
link against. You can do this simply by dragging the product of A1 to the Link
Frameworks and Libraries phase of B1. You can find the product of A1 listed
under A's entry in the project tree.

In short, dependencies are orthogonal to linking, and if you want both, you need
to specify both.

Ben

--
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>

I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
Back to top
Login to vote
Brian Meidell

External


Since: Nov 14, 2007
Posts: 1



(Msg. 3) Posted: Wed Nov 14, 2007 12:44 pm
Post subject: Re: XCode 3 static library dependency linking [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Is there a way to specify these dependencies besides the "Link binary
with libraries" group - because as far as I understand, there is no
way to change the content of this group per configuration (debug/
release).

I have this setup:
Project with multiple targets, one of which is my app, the others are
static libraries.
I have all the libraries set as dependencies for my app, so when I
recompile the app, the libraries also recompile if they have changed.
I want to link with the configuration specific build of the targets -
and this is where it seems to become tricky. The only way I've found
to do this is with "Other linker flags", using "-lmylibtarget" - this
works, but it breaks the dependency check that the "link binary with
libraries" group would give me - namely that if mylibtarget recompiled
and changes, my main app should re-link.

I really hope that I am an idiot and that I am doing it wrong, because
otherwise I think it's mindboggling that such a common way to work
does not have a nicer workflow in xcode.

I guess my problems would be solved if I could just manually set
dependencies to files, per configuration.
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Zerolink and static library - I have been using zerolink in xcode for a while with no trouble, but recently I added a static library to my project. T...

Help! Static library won't link - I need some help here. I'm in the process of porting a Codewarrior project over to XCode. I've gone through the machi...

EXC_BAD_ACCESS when using cerr in static library - I'm trying to run code which reads a number of different file formats. So, I have a for loop that loops over my differe...

Force build static libraries in Xcode? - Hi, Mac OS X 10.2.8 (I believe) used static libraries, but then Apple decided to switch to dynamic libraries. I want t...

Question About XCode and Static Carbon Libraries - After using CodeWarrior for years, I have finally been forced to make the inevitable switch to XCode. I will spare ever...

Linking a Cocoa Framework with a C++ dynamic library - Hi, I'd like to build a cocoa framework which links with a dynamic c++ library. To explore the intricacies of this tas...
       Soft32 Home -> Mac -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows
 Linux
  Mac
 PDA



[ Contact us | Terms of Service/Privacy Policy ]