Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a file with extension .a?

I downloaded this: https://github.com/mongodb/mongo-c-driver

And now I'm trying to use it inside my C program, but I don't know what to do with the generated .a files. What are they? I couldn't find any information, not even in the GCC manual.

And I built it like so:

  scons --c99 

Also, can I use C99 libraries with my C89 program?

like image 234
Blub Avatar asked May 11 '11 13:05

Blub


People also ask

What can open file type A?

You can use file identification utilities like File Viewer Plus, TrIDNET, File Viewer for Mac, File Viewer for Android, or the Linux file command to identify a file's contents. After identifying your file's contents, if it is a legitimate file, you should rename it to use the correct extension.

How do I identify a file type?

Right-click the file. Select the Properties option. In the Properties window, similar to what is shown below, see the Type of file entry, which is the file type and extension.


2 Answers

.a files are static libraries typically generated by the archive tool. You usually include the header files associated with that static library and then link to the library when you are compiling.

like image 145
GWW Avatar answered Oct 14 '22 12:10

GWW


.a files are created with the ar utility, and they are libraries. To use it with gcc, collect all .a files in a lib/ folder and then link with -L lib/ and -l<name of specific library>.

Collection of all .a files into lib/ is optional. Doing so makes for better looking directories with nice separation of code and libraries, IMHO.

like image 45
Sriram Avatar answered Oct 14 '22 12:10

Sriram