Sign up ×

I am just doing a little work this morning making some static libraries. Why do static libraries end with '.a'?

No one in my office knew, so I thought I would ask around on Stack Overflow. We are writing code in C++, C, and Objective-C.

share|improve this question
I suppose if anyone knows the history behind this that would be pretty interesting. –  Kaili Sep 17 '10 at 16:24
Tagged with POSIX -- on Windows the common extension is .lib. –  Billy ONeal Sep 17 '10 at 16:29
@Billy: is the .a extension specified by POSIX though? –  jalf Sep 17 '10 at 19:34
@Billy,jalf: it's more specific to GCC and likewise compilers... MinGW (Windows) also uses .a as the import/static library extension. –  rubenvb Sep 17 '10 at 19:39
Other compilers use '.lib" extension. –  Thomas Matthews Jun 28 '12 at 21:53

3 Answers 3

up vote 15 down vote accepted

I think the .a convention comes from using an "archiver" to place the object files into a static library.

share|improve this answer

That's just a convention on Unix-based systems. Visual Studio (Windows) generate .lib files.

In fact, I just discovered that there are several other namings, see Wikipedia article Library (computing), section File naming.

share|improve this answer
I would be curious to know the history behind this convention. I wonder if it's documented anywhere? –  Mark Ransom Sep 17 '10 at 16:23
I thought it might stand for something. Must have been a grad student that thought it was a good idea to give it a one letter extension lol –  Kaili Sep 17 '10 at 16:23
Yeah I added the link to wikipedia, that's interesting. –  Klaim Sep 17 '10 at 16:24

It's an archive format (think of .zip or .tar) containing .o object files generated by "ar". The linker just treats it as if the object files were specified individually.

share|improve this answer
If you specified the .o file individually the linker might include them even if none of their symbols were specified, but with .a files linkers usually only bring in .o files within the archive who are required to satisfy the object being built. –  nategoose Sep 17 '10 at 16:34

Your Answer


