Rishabh
Rishabh

Reputation: 3852

What is a .a file used for in xcode 4

I would like to know what a .a file is used for? I had downloaded a SDK and what I got was a set of .h files and a .a file , may I know for what is the function of .a file ?

Upvotes: 2

Views: 6587

Answers (2)

cdyer
cdyer

Reputation: 1259

A .a file is a statically linked library. You link to this binary during the compilation of any programs you write using it and the code of the SDK will be included in the final binary of your program. It differs from dynamically linked library where your binary only references the external code.

The .h files include declarations of the functions implemented within the .a file.

Upvotes: 7

Carl
Carl

Reputation: 1832

an .a file is generally a precompiled library file. The .h files will have the definition of all the classes inside the .a file.

You program using the interfaces defined in the .h files, and then configure xcode to link the library in when building your project.

To actually use it in your project, add all of your downloaded files to xcode as you normally would, but there is an additional step with the library. If you navigate to the project (using xcode 4) then select the 'Build Phases' tab you will see a number of phases. You need to select the 'Link Binary with libraries' phase and add the .a file there.

Upvotes: 7

Related Questions