• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Where to put static libraries?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where to put static libraries?


  • Subject: Re: Where to put static libraries?
  • From: Markus Hitter <email@hidden>
  • Date: Thu, 12 Feb 2004 12:01:15 +0100

Am 12.02.2004 um 04:21 schrieb Marty Ray:

I'm fairly new at writing software, so forgive the "basic-ness" of this, but I selected 'Add File...' from the project menu and added the library to my project and I still get an error stating that libmysql.a could not be found.

How do I specify the location of my library in my #include < > statement?

Hmmm - maybe you mix libraries with their headers?

Headers are sort of a description for a library. They are text files and go into some known place. Headers are needed to compile a source file.

The library its self is a binary file sitting in some other place. The library is needed when you link your program after compiling the single pieces (objects).

To build an app, you need both, headers and the library.


So, the classical UNIX way is to put all headers into /usr/include, /usr/local/include or a few similar places. Libraries go into /usr/lib, /usr/local/lib or similar. This is how MySQL does it as well.


In opposite, the invention of a framework was to put both, headers and libraries into a single place. If you tell Xcode to use some framework, Xcode knows where to look for the headers and where to look for the library. There are some other advantages as well.

With MySQL - the classical way - you have to tell Xcode both, where to find the headers and where to find the library. How to add the library you found out already.

The Xcode folks recommend to add header files in the same manner. Should be fine to add the whole folder as a folder reference recursively. I didn't do so yet but it sounds like the most intuitive way.

Classical UNIX way to do so however, is to add an header search path. The compiler will look there to find header files. Click on your target, then on the blue "i" in the toolbar to get the info panel. In the Build tab it's the first item on top of the list. Just type the path in.


To debug your work - if needed -, try to build the thing. Then open Menu -> Build -> Show Detailed Build Results. Drag the split view up, it's all down by default. There's a lot of text. One or more lines begin with "/usr/bin/gcc-3.3 ...". Later in this line there are some parameters beginning with "-I". They tell the compiler about the header search paths. If you are unsure, copy this path to a terminal, add "ls " in front of it and look what the shell says.




Actually, I'm not even sure where my include should go.

Depends on where you need it. If you use MySQL symbols in your own header already, put it on the top of this header. If you don't need it there, put it into the source. Other sources including your header will have less work, then.


Use #include "..." instead of #include <...> since you don't need to search the default paths.



Have fun,
Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Where to put static libraries? (From: Marty Ray <email@hidden>)
 >Re: Where to put static libraries? (From: Markus Hitter <email@hidden>)
 >Re: Where to put static libraries? (From: Marty Ray <email@hidden>)

  • Prev by Date: Re: strange looking ambiguity with type cast
  • Next by Date: Re: java application targeting
  • Previous by thread: Re: Where to put static libraries?
  • Next by thread: Creating syntax files
  • Index(es):
    • Date
    • Thread