What is the difference between these two file types. I see that my C++ app links against both types during the construction of the executable.
How to build .a files? links, references, and especially examples, are highly appreciated.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
.ofiles are objects. They are the output of the compiler and input to the linker/librarian..afiles are archives. They are groups of objects or static libraries and are also input into the linker.Additional Content
I didn’t notice the ‘examples’ part of your question. Generally you will be using a makefile to generate static libraries.
This will compile
hello.candworld.cinto objects and then archive them into library. Depending on the platform, you may also need to run a utility calledranlibto generate the table of contents on the archive.An interesting side note:
.afiles are technically archive files and not libraries. They are analogous to zip files without compression though they use a much older file format. The table of contents generated by utilities likeranlibis what makes an archive a library. Java archive files (.jar) are similar in that they are zip files that have some special directory structures created by the Java archiver.