Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build static library

I am trying to build a .a static library for my iPhone project.

So, I have created a new project, and I used the template Cocoa Touch Static Library.

Then, in XCode 4.0, I add my .m and .h files.

i have successfully build the project, but no .a file is created In XCode, I see .a file in Products category but displayed in red; so it doesn't exist.

I don't understand why my build button don't create .a file, any help?

like image 215
TheFrancisOne Avatar asked Apr 20 '11 15:04

TheFrancisOne


People also ask

What is static library in C++?

A static library (also known as an archive) consists of routines that are compiled and linked directly into your program. When you compile a program that uses a static library, all the functionality of the static library that your program uses becomes part of your executable.

How do I create a static library in Visual Studio?

To create a static library project in Visual StudioOn the menu bar, choose File > New > Project to open the Create a New Project dialog. At the top of the dialog, set Language to C++, set Platform to Windows, and set Project type to Library.

What is static library in Linux?

Static libraries are simply a collection of ordinary object files; conventionally, static libraries end with the ``. a'' suffix. This collection is created using the ar (archiver) program.


1 Answers

I see that you accepted the answer, but I thought I'd leave a note for future library developers. After upgrading an Xcode 3.x based static library project to 4.x, the library will not always upgrade and begin doing universal library builds. When this happens, the project build will be successful and apps linked against the target dependency will run fine, but you'll get red static library files showing in the projects you pull in. This is very annoying and the only fix I have found is to recreate the project files -- I tried auditing the build settings but was unable to figure out the confounding factors.

Hope this helps save somebody the 2 hours I just lost :-P

like image 138
Blake Watters Avatar answered Nov 15 '22 23:11

Blake Watters