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 to libs in Xcode?



On Nov 15, 2004, at 6:27 PM, a monkey wrote:

When compiling a single source code file using the cc or g++ command, if your program uses routines that require linking to a library, you must do so by adding an option to the command, such as -lncurses. Being an Xcode supporter, I would like to know how to link libraries to an Xcode project. Using Xcode, I can easily compile command-line tools that don't use routines from any library. But I would find it extremely useful to be able to use, say, the ncurses library in my project. Does anybody know how to do this? If so, please explain your answer to me.

1) I think that before you ask more questions you may want to read up on the Xcode documentation, starting with

http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeQuickTour/

and

http://developer.apple.com/documentation/DeveloperTools/Conceptual/Build_System/

The quick answer is that you add the library to your project, making sure it is a member of the targets whose source code invoke it. It's automatically added to the Frameworks & Libraries build phase for those targets. Xcode compiles the source files individually, then links them all together with the ld dynamic linker; the libraries and frameworks in that build phase are passed with the -l and -F command line parameters to ld.

2) You may wish to use the xcode-users list for questions about the development environment.

Chris
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Link to libs in Xcode? (From: a monkey <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.