tags:

views:

31

answers:

1

I'm in the process of porting some code from Linux to Mac OS X. The code is a static library that you add to your code. Basically after you compile the code you get a MyLib.a that can be linked to whatever project you want. I'm managing the "project" via a Makefile.

Is there a way to have a project on Xcode that ultimately produces the same kind of library? How?

Thank you for the help.

A: 

Sure. You don't say so, but I am assuming you are using C or C++ as source.

Assuming you are using Xcode 3.2.2, you can create a new project (File > New Project...), which will bring up a New Project window with available project templates. Select the "Framework & Library" category under Mac OSX from the list on the left. You should now see a "BSD C Library" and "STL C++ Library" among the other library and framework types. For building a static library like you described you want the "BSD C Library" option. There are static and dynamic options for this which you will see when you click on the icon, but static is default.

Depending on which version of Xcode you are using, the location of the project template may be a little different since Apple has been changing this UI for the New Project window fairly frequently. So if you are not using 3.2.2 you may need to poke around the available projects a little bit.

Oh, and don't worry if you are trying to build C++. Event though this says it is for C, C++ libs build just fine as well.

JeffW