Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Link problem with custom static library



On Nov 30, 2005, at 3:32 AM, Rustam Muginov wrote:

I am trying to link with custom static library (.a file) using xcode 1.5 under 10.3.9
The library does not have the "lib" prefix in its name, lets say it is called "MyLib.a"
Linker is not able to find it, reporting error "ld: can't locate file for: -lMyLib"
If i rename library to "libMyLib.a" in Finder, and re-add it to the project, then it is linked ok.
Could i make XCode not to require "lib" prefix to every library?

On Nov 30, 2005, at 7:11 AM, Daniel Jalkut wrote:
If you're just interested in accumulating a mass of sources into a linkable ball, you can look forward to upgrading to 10.4 and Xcode 2.2. They now include a "binary object" target type which can be named haphazardly and linked into another project outside of the usual "library" rules.

This is also fixed in the IDE for regular static libraries and dynamic libraries in Xcode 2.1.


-l always requires the library to start with "lib" and end in ".a" or ".dylib". The nice thing there is that this can find the library in a variety of places without you having to specify them each time, via the library search paths.

But if you just pass in the library by its full path, then the linker will do the right thing, without the name having to be in any format. So Xcode now tests the name of the library, and uses -l if the library name follows the -l style, and just passes in the full path otherwise.

Xcode 2.1 requires Mac OS X 10.4 "Tiger", however.

-- Andrew Pontious
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >Link problem with custom static library (From: Rustam Muginov <email@hidden>)
 >Re: Link problem with custom static library (From: Daniel Jalkut <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.