开发者

What is a file with extension .a?

开发者 https://www.devze.com 2023-03-04 22:25 出处:网络
I downloaded this: https://github.com/mong开发者_C百科odb/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

I downloaded this: https://github.com/mong开发者_C百科odb/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?


.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.


.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.

0

精彩评论

暂无评论...
验证码 换一张
取 消